$_ is just a global variable (with a funny name).
Many functions or operators just use this variable, when
you not explicitly tell them to use another one.
e.g chomp. chomp needs a variable to work on.
You can supply one like

chomp $x;

If you don't chomp thinks you mean

chomp $_;

and acts exactly that way. So

chomp;

and

chomp $_;

are exactly the same.

Many building functions and operators work that way
(e.g <>, s///, m//, split);

hope this helps,

cr



On Sun, 22 Apr 2001 13:47:52 -0500, Chris Brown said:

> i have read about it in 3 books and even used it in scripts i have made but i still 
>dont truly know how to be sure what $_ contains...can anyone clear this up for me? 
>Thanks
>  Chris Brown
>  

Reply via email to