[LA.pm] push question

Ofer Nave ofer at netapt.com
Thu Mar 3 23:35:04 PST 2005


On Thu, 3 Mar 2005, Robin Rowe wrote:

> > What are you doing in your real program, what do you expect to see, and
> > what are you actually seeing?
> 
> These are the only lines that matter.

Probably not.  Read on.

> @lines = <FILE>;
> push(@lines,$string);

You're doing it perfectly.

> I simply want to append another line to an array of lines read from a file, 
> but push doesn't do what I expected. Does anyone know how to push a string 
> onto an array of strings read from a file?

I see nothing wrong with your code.  It looks to me like it's doing 
exactly what you described wanted to accomplish.

Now, when you say "doesn't do what I expected"... well, we can't even 
begin to fathom what's wrong and how to help you unless you tell us what 
it IS doing.

Quick guide to writing intelligent questions:

1) show us the code, preferably with a brief explanation of what it's 
about
2) say what you expected it to do
3) say what it actually did

Remember - you're helping us to help YOU.

-ofer



More information about the Losangeles-pm mailing list