Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
is it possible to print the "MISSING" label for a non existing hash element, using a single line sprintf command as below (which does not work) ?
Thank you
my $missing = "MISSING"; my %h = ( A => 1.23435 ); my $out = sprintf "%.3E", $h{A} || $missing; warn $out; $out = sprintf "%.3E", $h{B} || $missing; warn $out;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Printing non existing hash values as "missing"
by pme (Monsignor) on Jun 10, 2015 at 11:15 UTC | |
by Anonymous Monk on Jun 10, 2015 at 12:19 UTC | |
|
Re: Printing non existing hash values as "missing"
by Anonymous Monk on Jun 10, 2015 at 12:32 UTC | |
by Anonymous Monk on Jun 10, 2015 at 13:43 UTC | |
by Anonymous Monk on Jun 10, 2015 at 14:15 UTC | |
by Anonymous Monk on Jun 10, 2015 at 12:47 UTC | |
|
Re: Printing non existing hash values as "missing"
by hippo (Archbishop) on Jun 10, 2015 at 11:17 UTC | |
by Anonymous Monk on Jun 10, 2015 at 12:15 UTC | |
by jeffa (Bishop) on Jun 10, 2015 at 16:20 UTC |