Stupid Perl Tricks

From Federal Burro of Information
Revision as of 18:47, 27 January 2009 by David (talk | contribs)
Jump to navigationJump to search

#foreach my $part ( @dateparts ) {
#       print "Part: ".$part."\n";
#}

#while (my ( $key, $value) = values %data) {
#       print $key." = ".$value."\n";
#}

#!/usr/bin/perl

@my_time = localtime(time());
print "sec:     $my_time[0]\n";
print "min:     $my_time[1]\n";
print "hour:    $my_time[2]\n";
print "mday:    $my_time[3]\n";
print "mon:     $my_time[4]\n";
print "year:    $my_time[5]\n";
print "real year:       ".($my_time[5]+1900)."\n";
print "wday:    $my_time[6]\n";
print "yday:    $my_time[7]\n";
print "isdst:   $my_time[8]\n";

# ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)

# for Good perl.

#!/usr/bin/perl -w
use strict;
use warnings;
use diagnostics;

need to learn more: Moose ? vat ees eet?