Sorry if this has been asked before but I can't seem to make SuperSearch do anything except give me errors and the google search is somewhat hard to use on this site.
I'm trying to pass a hash reference from fetchrow_hashref into a function and it's not working.
my $book_hashref = $sel_cursor->fetchrow_hashref;
display_basic($book_hashref);
then
sub display_basic
{
my $book_ref = shift;
print "$book_ref->{'name'}<br>\n";
}
When I run this I get this error:
"my" variable $book_ref masks earlier declaration in same scope at Dis
+playStuff.pm line 100.
syntax error at DisplayStuff.pm line 96, near "sub display_basic"
syntax error at DisplayStuff.pm line 102, near "}"
I'm somewhat new to hash references so if somebody could enlighten me as to what I need to do to make this work (or at least point me at a site I missed during my searching) I would greatly appreciate it. Thanks in advance.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.