puterboy has asked for the wisdom of the Perl Monks concerning the following question:
but it always performs the join even if there is no second element. Adding an intermediate assignment, made it work:join("_", unpack("H32V*", $string));
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?my @temp = unpack("H32V*", $string); join("_", @temp);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Casting return value of unpack properly
by jethro (Monsignor) on Feb 12, 2013 at 16:00 UTC | |
by puterboy (Scribe) on Feb 12, 2013 at 16:39 UTC | |
by mbethke (Hermit) on Feb 12, 2013 at 16:53 UTC | |
|
Re: Casting return value of unpack properly
by AnomalousMonk (Archbishop) on Feb 12, 2013 at 16:33 UTC | |
by puterboy (Scribe) on Feb 12, 2013 at 16:41 UTC | |
by AnomalousMonk (Archbishop) on Feb 12, 2013 at 17:12 UTC | |
|
Re: Casting return value of unpack properly
by Anonymous Monk on Feb 12, 2013 at 16:00 UTC |