[Israel.pm] Perl signature - TTW (time to weekend)

Srikanth Madani srikanth.madani at vodafone.com
Thu Mar 18 04:50:32 PST 2004


Gaal Yahas responded:
>You're not protecting the two ''s (arguments to join) from the shell,
>so join sees an empty first argument.

Thanks Gaal. I changed the _'_ to a _"_ and it worked.

I now have:
> perl -e'$_="87 69S69E75C69S78
68A32W73A83Y32!";($p,$i,$n,$k,$f,$l,$o,$y,$d,$s)=(localtime,join"",map(chr,s
plit/\D/));$o>4?print$s,HERE:print$s,435660-86400*$o-3600*$n-60*$i-$p,join""
,split/\d+/'

Is there some way I can shorten this?

For example, I use the variables $d, $f, $k, $l and $y only once - but I
need them to handle the localtime function.
I guess I could use a single variable for all of these, like:

($p,$i,$n,$d,$d,$d,$o,$d,$d,$s)=(localtime etc.

but that doesn't shorten it, and it takes away the Pink Floyd from it!


Cheers,
Srikanth Madani




More information about the Perl mailing list