Hi David,
I do set the line, and thats why I am not sure, why it
doesn't work:
while ( $line = <STDIN> )
{
$idNumber = $line =~ /\((ID\d+)\)/;
}
print $idNumber; // empty
Thanks again!
--- David T-G <[EMAIL PROTECTED]>
wrote:
> Leon --
>
> ...and then lz said...
> %
> ...
> % Here is a line from my file:
> % Dear Test Test1(ID127158),
> ...
> %
> % I use the following line, when I am reading the
> file:
> % ($idNumber) = $line =~ /\((ID\d+)\)/;
> %
> % For, some reasons idNumber is still empty....
>
> Do you actually read the line into $line? My famous
> one-liner method
> shows
>
> echo "Dear Test Test1(ID127158)," | \
> perl -e 'while (<>) { $line = $_ ; \
> ($id) = $line =~ /\((ID\d+)\)/; } \
> print "$id\n";'
> ID127158
>
> Note the while loop and the setting $line = $_ on
> the "perl -e" line;
> if you don't set $line, then the match won't have
> anything against which
> to work.
>
>
> %
> % Thanks again!
>
> HTH & HAND
>
>
> :-D
> --
> David T-G * It's easier to
> fight for one's principles
> (play) [EMAIL PROTECTED] * than to live up to
> them. -- fortune cookie
> (work) [EMAIL PROTECTED]
> http://www.justpickone.org/davidtg/ Shpx gur
> Pbzzhavpngvbaf Qrprapl Npg!
>
>
> ATTACHMENT part 2 application/pgp-signature
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]