localtime returns a list and ( )[0..2] is a list slice that narrows down that list to the first three elements. localtime also accepts a numerical argument (usually time) but the number you are supplying in the second example is a reference to an anonymous array (localtime[0..2] is the same as localtime\@array). But as you are reading from the beginning of the list you don't really need the list slice at all:
my ($sec, $min, $hour) = localtime;
Will do the same as the first example.
In reply to Re: (localtime) versus localtime - round 1
by jwkrahn
in thread [Updated] (localtime) versus localtime - round 1
by Lawliet
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |