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: msg25583/pgp00000.pgp
Description: PGP signature

Reply via email to