>However, I really don't want to see 'return' become a kind of 'last'
>for do{}. How would I return from a subroutine from within a do loop?
You already can't do that (as it were) from within an eval.
But I while I am not completely bothered by letting the value
dangle here:
($msg, $defstyle) = do {
my $i = find_when($orig);
$i == 1 ? ("First", "Color" ) :
$i == 2 ? ("Then", "Rarity") :
("Then", "Name" )
};
or here:
($FORMAT_NAME, $FORMAT_TOP_NAME) = do {
if ($long_form) { qw( Long Long_Top ) }
elsif ($just_inode) { qw( Inodes Inodes_Top ) }
elsif ($sys5) { qw( SysV SysV_Top ) }
elsif ($bsd) { qw( BSD BSD_Top ) }
else { die " No format?" }
};
It just kinda irks me here:
$total += 2 * do {
my $count = 0;
for $n (@nums) { $count += $n }
$count;
};
I rather that were:
$total += 2 * do {
my $count = 0;
for $n (@nums) { $count += $n }
return $count;
};
--tom
- The distinction between "do BLOCK while COND&qu... Bart Lateur
- Re: The distinction between "do BLOCK whil... Peter Scott
- Re: The distinction between "do BLOCK ... Nathan Torkington
- Re: The distinction between "do BL... Tom Christiansen
- Re: The distinction between "d... Bart Lateur
- Re: The distinction between &q... Tom Christiansen
- Re: The distinction betwee... Christopher J. Madsen
- Re: The distinction be... Jonathan Scott Duff
- Re: The distinction be... Christopher J. Madsen
- Re: The distinction be... Jonathan Scott Duff
- Re: The distinction be... Tom Christiansen
- Re: The distinction be... Christopher J. Madsen
- Re: The distinction be... Tom Christiansen
- Re: The distinction be... Christopher J. Madsen
- do BLOCK as inline sub... Uri Guttman
- Re: The distinction between "d... Peter Scott
- Re: The distinction between &q... Christopher J. Madsen
- Re: The distinction betwee... Peter Scott
- Re: The distinction be... Tom Christiansen
- Re: The distinction be... Chaim Frenkel
- Re: The distinction be... Tom Christiansen
