http://qs321.pair.com?node_id=55330


in reply to Re: Re: push
in thread push

If you may have more than one value that you want to save, I'd use an array of (references to) hashes; at least, sticking with the structure you've already got. For that, you're going to need to read up on references, so perldoc perlref and perldoc perlreftut are your starting points. something like the following should get you started:

my @lines; # ... as before # instead of *your* push line, @facdata{@facfields} = @facrow; push @lines, \%facdata;

That will leave you with an array of references to hashes. This is a little hairier than the structure you might want (you could, e.g. just store an array of strings, and call the splits on those later. But whatever ...)

Philosophy can be made out of anything. Or less -- Jerry A. Fodor

Replies are listed 'Best First'.
Re: Re: Re: Re: push
by malaga (Pilgrim) on Jan 31, 2001 at 04:15 UTC
    i tried it that way and i get an error that it needs an explicit package. do you know which pm it might need?
      That error just means that you're running with use strict and have an undeclared variable.

      perldiag:

      Global symbol "%s" requires explicit package name (F) You've said "use strict vars", which indicates that all variables must either be lexically scoped (using "my"), or explicitly qualified to say which package the global variable is in (using "::").
      Odd that the explanation doesn't mention use vars, though...
Re: Re: Re: Re: push
by malaga (Pilgrim) on Jan 31, 2001 at 00:17 UTC
    thanks...i'll try again.