SPUG: Tie::File module

Chris Wilkes cwilkes-spug at ladro.com
Thu Feb 19 12:47:03 CST 2004


On Thu, Feb 19, 2004 at 10:34:14AM -0800, Luis Medrano wrote:
> 
> I try to experiment with Tie::file module buth I have a question. I'm
> running this code:
> 
> tie @lines, 'Tie::File', 'file' or die ...;
> 
> print "$line[0] \n";
> untie @lines;
> 
> I was specting to print just one line of the file but it print the
> whole file. Any idea why or how can I do it so it will print just
> one line??

I was going to say "Check and make sure your file has more than one
line" but now I'm going to say "use strict" and you'll see that you put
the file into "@lineS" (note the S) and you're printing out "$line"
(no S).

Chris



More information about the spug-list mailing list