Re: Find string ending with %
- From: krahnj@xxxxxxxxx (John W. Krahn)
- Date: Tue, 16 Aug 2005 17:59:41 -0700
[ message rearranged in chronological order. Please do not top-post ]
Timothy Johnson wrote:
>> From: Keenan, Greg John (Greg)** CTR ** [mailto:gjkeenan@xxxxxxxxxx]
>>
>> <snip>
>>
>> my @oput2 = /\b([0-9]+)%/;
>>
>> <snip>
>
> Just for starters, a regular expression should use the =~ operator, not
> the = operator.
>
> You might have seen some examples like this:
>
> while(<INFILE>){
> if($_ =~ /mybigregularexpression/){
> Do something...
> }
> }
>
> Check out 'perldoc perlre'.
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]+)%/;
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.
John
--
use Perl;
program
fulfillment
.
- References:
- RE: Find string ending with %
- From: Timothy Johnson
- RE: Find string ending with %
- Prev by Date: FW: Find string ending with %
- Next by Date: RE: Find string ending with %
- Previous by thread: RE: Find string ending with %
- Next by thread: FW: Find string ending with %
- Index(es):