![]() |
|
We don't bite newbies here... much | |
PerlMonks |
Re^2: Reading (the same) data in different ways & memory usageby Neighbour (Friar) |
on Apr 21, 2011 at 08:07 UTC ( [id://900490]=note: print w/replies, xml ) | Need Help?? |
And so I'm learning new things every day :) I have experienced difficulties with the @ and % prototypes, as I read in the link you provided, and stopped using those. The scalar prototypes are now purely used to enforce the right amount of arguments (as an added bonus, perl implicitly coerces any arguments supplied to scalars...this will definitely mess things up, but if you were supplying non-scalars to this function, that was bound to happen anyway, so I'm not worried about that much). It seems that open accepts one thing besides strings as the EXPR-argument (2nd or 3rd if a MODE is supplied), and that is a reference to a scalar to be used as an in-memory file. Even though this is not the case here, I've removed the stat-check, since open will give an error anyway if the file doesn't exist. Also $! has been included in the errormessage, should open fail. How does one substitution with capture compare to doing 2 substitutions without capture? I would have to benchmark this to figure out which is faster. The sprintf seems out of place, though, as with all user-supplied data, it's not certain that the default-values (looks like I missed one when translating "standaard" to "default") for (VAR)CHAR fields actually contains a string-value. However, this can also be done just using ""'s.
In Section
Seekers of Perl Wisdom
|
|