Hi guys,

Thanks a lot!
You were right - I got multiple lines in the file and
I guess while the variable was set when it found the
correct pattern, but was unset after it couldn't find
the pattern. 

Since, I don't need anything after I got my field, I
just used 'last' to exit out from the loop and it
seemed to work fine!

Thanks again!

--- David T-G <[EMAIL PROTECTED]>
wrote:
> Leon --
> 
> ...and then lz said...
> % 
> % Hi David,
> 
> Hello!
> 
> 
> % 
> % 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 
> 
> Very odd indeed.  I rewrote my one-liner in your
> format and tried it and
> it worked.
> 
> Oh!  I get it!  There's more than one line in the
> file, right?  So you
> first set idNumber because it matches, and then the
> next time (it's a
> loop) it doesn't match and thus clears it, and so
> on.
> 
> You *probably* want something like
> 
>   $idNumber = ...
>   last i $idNumber
> 
> to jump out of the loop once it has been
> successfully set.  Try that and
> let us know.  Better yet, try last so that it works;
> I have no idea
> whether or not that snippet will run :-)
> 
> 
> % 
> % 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]

Reply via email to