On Jul 4, Josh said:
>[Jul 4 13:55:03 small sendmail[29727]: NAA29721: to=<[EMAIL PROTECTED]>,
>delay=00:00:00, xdelay=00:00:00, mailer=uucp-dom, relay=gate, stat=Sent ]
> if ($record =~ /^(...)\s+(\S+) (..):(..):(..) \S+
>sendmail.[0-9]+.: (\S+): to=(\S+).*, delay=..:..:.., xdelay=..:..:..,
>mailer=\S+, relay=(\S+), stat=\S+ $/)
Your regex requires matching *3* characters at the beginning of the string
before whitespace. This string has *4* "[Jul". You're also doing a lot
of longwinded operations. You're matching a regex... then substituting
that regex with the captured parts... then splitting those captured parts
by whitespace.
What's wrong with just getting them as they are?
if (($this, $that) = $string =~ /abc(...)def(...)/) { ... }
That does what you wanted in far less steps.
> (undef, undef, undef, undef, undef, $year) = localtime;
How about:
$year = (localtime)[5];
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
** Manning Publications, Co, is publishing my Perl Regex book **