> In a message dated 3/9/2004 2:43:16 PM Eastern Standard Time,
> [EMAIL PROTECTED] writes:
> >Hi all, I'm trying to figure out how can I check if a variable
matches the
> >first 5 digits of the line below without removing anything from the
line.
> >
> >13384 R 20020920 N Gatekeeper, The
> >
> >Silver Fox
>
> use strict;
> use warnings;
> my $line = "13384 R 20020920 N Gatekeeper, The";
> my $var = 13384;
> my ($match) = ($line =~ /(\d{5})/);
Careful, I believe we want the above capture anchored to the start of
the line, though I prefer the direct match approach...
http://danconia.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>