Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Re: push

by malaga (Pilgrim)
on Jan 31, 2001 at 00:01 UTC ( #55327=note: print w/replies, xml ) Need Help??


in reply to Re: push
in thread push

i need to keep search the rows because there will be more than one with the value i'm looking for. can i do a while and a foreach in the same statement?

Replies are listed 'Best First'.
Re: Re: Re: push
by arturo (Vicar) on Jan 31, 2001 at 00:09 UTC

    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

      thanks...i'll try again.
      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...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://55327]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2022-01-27 22:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (72 votes). Check out past polls.

    Notices?