in reply to Declaring with my, assigning, and testing in same line
Seems to me the issue is the way doublequotes are interpolated. So...
mayybe simpler still, but -- admittedly -- not one line:
#!/usr/bin/perl -w use 5.018; use strict; # 1150034 my %foo = ("do"=> "done", "eggs" =>"green ham", "was" => "were",); my @v; (@v = keys %foo) == 1 or warn "Got more than one: " . @v . "\n"; print "V:@v\n";
OUTPUT:
Got more than one: 3 V:was do eggs
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Declaring with my, assigning, and testing in same line
by AnomalousMonk (Archbishop) on Dec 11, 2015 at 18:56 UTC |