> i am completely new to perl, can you explain to me the following line
> of
> code in red.
>
> how does this line of code grab a time value and assign it to $ time,
>
> how does assigment happend in this conditiona statement.
>
>
>
> while (<>)
> {
> chop;
> # Grab the time
> next unless ($time) = /(\d+:\d+:\d+\,\d+)/;
>
I don't see any line in red :-(
I presume time is written in a format such as YYYY:MM:DD,HH ( eg
2009:01:29,15 )
/(\d+:\d+:\d+\,\d+)/ is therefore the regular expression that looks
for digits separated by colons and finally a comma
\d+: is any number of digits followed by a :
/(\d+:\d+:\d+\,\d+)/ will match 2009:01:29,15 but not 2009:01:29:15
Once a match is made, an assignment is made, otherwise $time would be
undefined or the value of the last match
Owen
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/