in reply to Is this a hash? or what?
Okay, let's take this apart piece by piece. First there's a call to print Easy enough. The EBDSET is (presumably) an open filehandle, which means that print will send the rest of the line to that file. parser appears to be a subroutine call. Somewhere else in the program you should find sub parser that defines what parser does. In particular, the arguments that are passed to parser (inside the ()'s) will show up in the @_ array.###### else { print EBSDET parser ($bai{$ocab}{d16}[$1]{text_full}, (27- $bai{$ocab}{d16}[$1]{n2_offset}), 27,"\;",12); } ######
Next, we have the arguments to parser(). There are 5.
references are a bit of an advanced concept, but basically they are a way to nest data structures (lists of lists, lists of hashes, etc)
Update:Adam correctly points out that I'm short selling references (see below). Read the replies for more in depth coverage, but this explanation is enough for this question.
Next:
@pay is an array. $#pay is the index of the last element of that array (Note that since arrays normally start at 0, "index of the last element" and "size" are not the same. $#pay+1 is normally the size of the array.push(@{ $pay[($#pay + 1)] }, $pay_aba, $pay_acct);
I suspect the problem here is again, references. Like I said, see perlref, but Here's the basics:
If $foo is a reference to an array (All references are scalar values), the way to deal with the array that $foo refers to is @{$foo} So here, we see that $pay[($#pay+1)] is being treated as an array reference. I don't imagine that's good practice, as $#pay+1 should not exist on @pay (It's one past the last index). A better way to write this would be:
This creates a reference to an anonymous array (consisting of $pay_aba and $pay_acct), and pushes it onto the end of @pay.push @pay, [$pay_aba, $pay_acct];
Hope this helps, and if you're a Perl newbie, here's the tip that everyone will tell you: Have your programs use strict;, and run perl with the -w flag. You'll get sick of error messages, but you'll quickly write better code, and better understand what's going on.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Is this a hash? or what?
by Adam (Vicar) on Sep 26, 2000 at 02:58 UTC | |
by swiftone (Curate) on Sep 26, 2000 at 18:42 UTC | |
|
RE: Re: Is this a hash? or what?
by eclecticIO (Beadle) on Sep 26, 2000 at 03:01 UTC |