WareLogging. Some bits of PerlLanguage. Also look at PerlCompatibleRegularExpressions. = one-liners and the like = $/ = "\n"; # record separator $re = qr/whatever/; # store a RegEx # ridiculous (shouldn't cut or basename do this?), but... # in your shell - count uniquely named jpgs: find . -iname '*.jpg' | perl -n -e 's{.*/(.*$)}{$1}; print'| sort | uniq | wc -l # 'course, find can do the filename trimming by itself: find . -iname '*.jpg' -printf '%f\n'|sort|uniq|wc -l = return a date-based directory name = (Edit this page to see brackets in the proper spot, until I fix the crappy markup around here.) #!/usr/bin/perl use POSIX qw(strftime); my @t = localtime; my $dir = strftime( "%Y/%m/%e", @t ); $dir =~ s/\/[0 ]/\//g; print $dir; = dispatch table to package subs = package Whatever::Thing; my %tags = ( p => \&tag, em => \&tag, small => \&tag, strong => \&tag, table => \&tag, ); # Install appropriate subs in symbol table: for my $key (keys %tags) { *$key = sub { $tags{$key}->($key, @_) }; } sub tag { my ($tag, $text, $class) = @_; if (defined $class) { return qq{<$tag class="$class">$text$tag>}; } else { return qq{<$tag>$text$tag>}; } } # should give you '
Some stuff.
' print p(strong('Some stuff'), 'item'); = print every so many lines = #!/usr/bin/perl @lines =