Juerd writes:
> > : > I don't think the command should default to $_
> > : Why?!
> > Because $_ is primarily for the use of inner loops, not outer loops,
> > and open tends to be in the outer loop rather than the inner loop.
>
> As someone who tries to write clean code, I agree that the outer loop
> should use a full name for the loop variable.
>
> But as someone who writes oneliners every day, I disagree that any such
> decision of how I should code should be made by the language designers.
>
> $_ exists at many levels, and I frankly don't see a big problem with
>
> for @files {
> open;
> say uc for =$_;
> close;
> }
Wait, so you want open to both open the filename in $_ /and/ set $_ to
the opened filehandle? Also, I don't buy your argument, since you can
do:
for @files {
say uc for =io($_);
}
Which the oneliner side of you should find awful nice.
Luke