|
|
| Do you know where your variables are? | |
| PerlMonks |
Casting return value of unpack properlyby puterboy (Scribe) |
| on Feb 12, 2013 at 15:34 UTC ( [id://1018395]=perlquestion: print w/replies, xml ) | Need Help?? |
|
puterboy has asked for the wisdom of the Perl Monks concerning the following question:
I am using unpack to unpack an element that consists of a 32 byte hex string plus an optional unsigned integer. If the integer exists, I want to join the 2 with an underscore. I tried: but it always performs the join even if there is no second element. Adding an intermediate assignment, made it work: But that seems kludgy and I would like to avoid it. So, is there any way to properly cast/assign the result of unpack so that an undefined second element is ignored by join without using an intermediate variable?
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||||||||||