On Wed, 2008-11-12 at 13:00 -0800, [EMAIL PROTECTED] wrote:
> I think I understand most of your suggestions but I'm not very clear
> in this line:
> 
> print $out $_;    # in the while loop below.
> 
> while (<$in>) {
>  s/\Q$search/$replace/g;
>  print $out $_;
> 
> 
> What is the $_ variable?

The $_ variable is Perl's generic variable.  It is used as the default
variable in input and match/substitution.  See `perldoc perlvar` and
search for "$_" or "$ARG".  The line:

  while( <$in> ){

is equivalent to:

  while( $_ = <$in> ){

> Is that an element of the @ARGV array?

No, the variable associated with @ARGV is $ARGV.  It is automatically
assign the name of the file from @ARGV when using <>.  See `perldoc
perlvar` and search for "$ARGV".

> If so, is my output file saved in $_ temporarily until it is 'sent'
> to
> the $out file handle and then copied $output?

Each line is saved for every pass through the while loop.

> Please excuse my ignorance if I am totaly off.
> 

Ignorance is the lack of knowledge and is not something you should ask
forgiveness for.  At one time, everyone was ignorant.  Those that are
arrogant with their knowledge have forgotten this and often need your
forgiveness.


-- 
Just my 0.00000002 million dollars worth,
  Shawn

The map is not the territory,
the dossier is not the person,
the model is not reality,
and the universe is indifferent to your beliefs.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to