perldoc perlmodlib
]]>
use POSIX; print strftime( '%Y%m%d%H%M%S', localtime ), "\n";
BTW, SI standard is year, month, day, hour, minute, second.
]]>my %convert = (
'*' => '.*',
'?' => '.',
);
s/(\W)/$convert{$1}||$1/eg;
I've been programming in Perl since version 4. Before that, I used awk, sed, and grep. Back then, Perl was a wonderful step up. :)
I think one of the reason Perl is not popular was because at one time, the Perl community got a bad reputation. This was party deserved, and party exaggerated.
To get Perl back among the popular languages will take, I think, a consorted effect by the entire community to show just how wonderful and useful it is.
]]>my @small = ( "", "1 penny\n", "2 pennies\n", "3 pennies\n", "4 pennies\n", "1 nickel\n", "1 nickel\n1 penny\n", "1 nickel\n2 pennies\n", "1 nickel\n3 pennies\n", "1 nickel\n4 pennies\n", "1 dime\n", "1 dime\n1 penny\n", "1 dime\n2 pennies\n", "1 dime\n3 pennies\n", "1 dime\n4 pennies\n", "1 dime\n1 nickel\n", "1 dime\n1 nickel\n1 penny\n", "1 dime\n1 nickel\n2 pennies\n", "1 dime\n1 nickel\n3 pennies\n", "1 dime\n1 nickel\n4 pennies\n", "2 dimes\n", "2 dimes\n1 penny\n", "2 dimes\n2 pennies\n", "2 dimes\n3 pennies\n", "2 dimes\n4 pennies\n", );]]>for ( 1 .. 10 ){
my $amt = int( rand( 1000 ));
printf "%.2f\n", $amt / 100;my $q = int( $amt / 25 );
my $r = $amt % 25;if( $q == 1 ){
print "1 quarter\n";
}elsif( $q > 1 ){
print "$q quarters\n";
}
print "$small[ $r ]\n";
}
use Data::Dumper; my @a = ( 1 .. 10 ); my $count = () = @a; my @list = () = @a; print Data::Dumper->Dump( [ \@a, $count, \@list ], [qw( *given *count *list )]);]]>
That is not simple?
]]>@Stevan Little -- see above comment about OO fanatics insisting that OO be use for everything.
@Olivier Mengué -- You will note how popular Perl 6 is.
]]>I simply don't believe that once OO is added to Perl, the religious fanatics won't insist OO for everything.
]]>