- or download this
use strict;
use warnings;
use diagnostics;
- or download this
warn "$var\n";
print "@things\n"; # array with spaces between elements
- or download this
chomp $var;
print ">>>$var<<<\n";
- or download this
my $copy = $str;
$copy =~ s/([^\x20-\x7E])/sprintf '\x{%02x}', ord $1/eg;
print ":$copy:\n";
- or download this
use Data::Dumper;
print Dumper(\%hash);
print Dumper($ref);
- or download this
print ref $ref, "\n";
- or download this
$ perl -MO=Deparse -p program.pl
- or download this
open my $fh, '<', 'foo.txt' or die "can not open foo.txt: $!";
- or download this
if (system $cmd) {
print "Error: $? for command $cmd"
...
print "Command $cmd is OK"
}
$out = `$cmd`; print $? if $?;
- or download this
eval { do_something() }; warn $@ if $@;
- or download this
use Carp qw(cluck);
cluck("var is ($var)");
- or download this
$ perl -MCarp::Always program.pl
- or download this
# what the heck does /^\s+$/ mean?
use YAPE::Regex::Explain;
print YAPE::Regex::Explain->new('/^\s+$/')->explain();
- or download this
use WWW::Mechanize;
if ($mech->success()) { ... }