On Tue, 3 Jul 2001, Luke Bakken wrote:

> my @dates = qw(2Jul2001 21Jul2001);
>
> for my $date (@dates)
> {
>       my ($month, $day, $year) =
>                       length $date == 8       ?
>                       unpack 'AA3A4', $date   :
>                       unpack 'A2A3A4', $date;
>
>       print "M: ", $month, "\tD: ", $day, "\tY: ", $year, "\n";
> }
>
> Unpack works well with fixed format data like this.

Why would you use unpack when this can be easily split apart with a regex?
I'd think unpack would be overkill!

-- Brett
                                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
An investment in knowledge always pays the best interest.
                -- Benjamin Franklin

Reply via email to