Timothy Johnson wrote:
John W. Krahn wrote:
[ message rearranged in chronological order. Please do not top-post ]
No. If I'm responding to a message in this format, I'll use this format, but there's nothing illegitimate about top-posting. It is the email format that most of the world follows, using Outlook or Outlook Express on Windows. If you want to rearrange my emails then go ahead, otherwise just deal with it.
<snip wrong advice>
The OP's example isn't using the =~ operator because it is implied that:
my @oput2 = /\b([0-9]+)%/;
Is short for:
my @oput2 = $_ =~ /\b([0-9]+)%/;
Touché. I didn't know about the magic. I stand corrected. My apologies.
Also the binding operators (=~ and !~) aren't used by regular
expressions. Regular expressions are the stuff between the match
operator delimiters (//) and in fact the binding operators can be used
with the tr/// operator which doesn't use regular expressions at all.
Correct. It is used (or implied) by the m// operator. 'perldoc perlop' would have been more helpful than 'perldoc perlre'.
So the solution is to use either of the following:
while(<DATA2>) {
my @oput2 = /(\d+)%/ or next;
print "XXX @oput2 XXX\n";
}
OR
while (<DATA2>) {
my @oput2 = /(\d+)%/;
print "XXX @oput2 XXX\n" if @oput2;
}
/binish/
--

|