Simple question.
What will dumper do if I ask it for @_ within a sub?
e.g.
print Dumper(@_);
or perhaps
print Dumper(\@_);
A different subroutine is calling dbAction()
That subroutine is passing an array into dbAction:
@params = ($sql,$_[0],$_[1]);
dbAction(@params);
sub dbAction(\@){
print Dumper(@_);
print Dumper(\@_);
}
The $sql may have two arguments on an update, but 6 on an insert, therefore I want to make sure that the references get placed accordingly to do the $dbh->prepare() and execute(). Using print statements
print "$_[0]\n";
print "$_[1]\n";
I can see that the data is there, but I want to use a for loop to make sure how many items are being passed in to the sub, and I get -1 when I ask for $#{@_}.
Dumper is breaking and I can't tell why.
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.