in reply to Get variables from if with regex
In your particular case, it is not so hard to combine the regexes into one:
Note that the binding operator =~ imposes a scalar context on its left operand, so matching an array does not do what you think.while (<IFILE>) { if (my ($word, $time_stamp) = /[#!]\s+(\w+)\s+(\d+)./) { print "[ $word $time_stamp ]\n"; } }
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Get variables from if with regex
by Saved (Beadle) on Mar 07, 2013 at 15:21 UTC | |
Re^2: Get variables from if with regex
by Saved (Beadle) on Mar 08, 2013 at 13:10 UTC | |
by choroba (Cardinal) on Mar 08, 2013 at 13:51 UTC | |
by Saved (Beadle) on Mar 08, 2013 at 14:08 UTC |
In Section
Seekers of Perl Wisdom