- or download this
use strict;
use warnings;
use diagnostics;
- or download this
print "$var\n";
print "@things\n"; # array with spaces between elements
- or download this
chomp $var;
print ":$var:\n";
- or download this
print ":$_:", ord($_), "\n" for (split //, $str)
- 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 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
# 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()) { ... }