Hi Willy,

What does push and what is $_
That will probably be your question.

Here is one example :

open(FH, "< $file");
while <FH> { ## <FH> is the File Handler we just openened with open
  ## We do something with ??
  ## Yes, no var is set but instead we use $_ for the current line.
  
  ## Now we can set a condition, and if $_ matches the requirement
  ## I want to store this line into a seperated array :
  
  if(m/mymatch/g) { 
  
  ## You don't have to specify the $_ anymore as this is default (I heard).
  ## Now we have the line that matches our key and I want to store it together
  ## with all the other lines in the document that contain this searchstring
  ## So :
  
  push @mymatches, $_ ;  ## Or of course: push(@mymatches, $_);
  
  ## We just pushed the current line (of the while <FH>) into the end of our 
  ## array @mymatches
  
   }  ## And of course we close our if-statement

} ## And we close our while statement


Hope this explaines your questions.


Regs David
--------------
>   
> drieux   <[EMAIL PROTECTED]>  has kindly answered 
> my question about $/ to change the way a loop parses text....  
> but his answer uses stuff which i am not familiar with yet:
> 
> drieux wrote...
> 
>   b) you might want to pass in a reference to the array - and fill it up
> 
>                         push( @$array_ref, $_ )
> 
> ....
> 
> 
> 
> i almost understand this- not really though...
> 
> i'm curious for an explanation :)  (btw- thanks drieux)
> 
> 
> 
> willy
> 
> *yawn* i need a nap...
> 
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to