On Monday 10 April 2006 01:20, Alan_C wrote: > On Sunday 09 April 2006 19:34, John W. Krahn wrote: > > Alan_C wrote: > > > Hi.
> > #!/usr/bin/perl -w > > use strict; > > > > my @search4 = @ARGV; # keywords > > > > @ARGV = glob 'xtst*'; > > my @lines; > > while ( <> ) { > > if ( s/^#:// ) { > > push @lines, [ $ARGV, split ]; > > # what are the square brackets, does that create array reference? That is an anonymous array, and yes it does return an array reference. So, @lines will end up being an array containing references. which leads to you second question. > > } > > > > # quit looking when we reach the ninth line > > close ARGV if $. == 9; > > } > > print @lines, "\n"; # neither of these print and I don't know why > print @$lines, "\n"; The first print you are trying to print out the references. The second you are saying that lines is a reference to an array, which is not the same as an array of references. You could use this map {print @$_} @lines; or use a foreach to assign the references in @lines to a variable and print the contents out. > [ just for brevity's sake, snipped remainder of code ] > > -- > Alan. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>