[LA.pm] push question

Allen Day allenday at ucla.edu
Thu Mar 3 22:34:58 PST 2005


On Thu, 3 Mar 2005, Robin Rowe wrote:

> Hi. Having a little trouble with 'push' not doing what I'd hoped.
> 
> I'm reading an array from a file:
> 
>  @lines = <FILE>;
> 
> I want to append some additional data to the array, but it doesn't do what I 
> expect.
> 
> Here's a test program that illustrates what I'm doing.
> 
> @lines={1,2,3};

@lines = (1,2,3);

> push(@lines,4);
> push(@lines,5);
> 
> foreach(@lines)
> { printf "%s-", $_
> }
> 
> Here's the output:
> 
> % perl pushtest.pl
> HASH(0x334ca0)-4-5
> 
> What I want is 1-2-3-4-5. How?
> 
> Thanks!
> 
> Robin
> -------------------------------------------------------------------
> Robin.Rowe at MovieEditor.com   Beverly Hills, California
> www.LinuxMovies.org - Advancing Linux motion picture technology 
> 
> _______________________________________________
> Losangeles-pm mailing list
> Losangeles-pm at pm.org
> http://mail.pm.org/mailman/listinfo/losangeles-pm
> 


More information about the Losangeles-pm mailing list