|
Tip1. Perl script to remove ^M characters ---------------------------------------------------
#!/usr/bin/perl
while (<>) { $_ =~ s/\cM\n/\n/g; print $_; }
This will output to stdout the content of file given as parameter. Save it to remove_m.pl and use it:
remove_m.pl source.txt > dest.txt
Tip 2. Show servers's environment variables: $ENV ----------------------------------------------------------------
#!/usr/bin/perl -w
use strict;
print "Content-type: text/html\n\n";
print "<html><body><table>";
foreach (sort keys %ENV) {
print "<tr><td>$_</td><td>$ENV{$_}</td></tr>\n";
}
print "</body></html>";
Tip. 3 Install a Perl module from CPAN. (Example for module Mail::Mailer) --------------------------------------------------------------------------
You know howto install a perl module by adding a FreeBSD package for that module or by building the module from ports, but how if you want to automatically install a Perl module from CPAN. Well, Perl has the feature to automatically install any module from CPAN by using the following line:
perl -MCPAN -e "install Mail::Mailer"
This will install Mail::Mailer to your system.
|