Ben Crane wrote:
> Bob,
>
> Excellent, one more question: using my (x,y,z) = /x/
> /y/ /z/ to place the access log data into various
> variables, can you use the split command within this
> context? eg.
>
> my (x,y,z,a,b,c) = /x/ /y/ /z/ /split (abc)/ ??

Hi Ben.

I'm kinda worried that you're discarding the sign of the
time zone, as (obviously) it can be from +1200 to -1200.

Do you like this solution?

  my $dtime = '[15/Jan/2003:11:25:46+0000]';
  my @dtime = $dtime =~ /\+?\w+/g;
  print "@dtime\n";

OUTPUT

  15 Jan 2003 11 25 46 +0000

You can assign individual scalars by just assigning them
from the array.

  my ($dy, $mo, $yr, $hr, $mi, $sc, $tz) = @dtime;

(or skip the array altogether and assign them straight
from the regex.)

HTH,

Rob





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to