On Tue, 13 Jul 2004, Jonathan Scott Duff wrote:
> > I rather have a much "bigger" wish for an open-like operator that to be
> > fair I would like to see *also* in Perl5: nothing that one can do in well
> > more than one way in any case (also including creating a module that will
^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^
> > do exactly what I write below...), but that indeed would come handy
> > occasionally.
^^^^^^^^^^^^
^^^^^^^^^^^^
> From your description, it sounds like this is what you want:
>
> {
> local @ARGV = qw(foo bar baz and some other files);
> while (<>) {
> # ... ARGV and friends are at your disposal
> }
> }
Yes, in fact this is One Way To Do It(TM), and one that indeed I have
used, when I felt I needed it.
However, there are *admittedly* rare cases in which it plainly won't do:
while (<$fh>) { # $fh just as magic as ARGV
my $l=<>;
# ...
}
And once one has such a function, then the default *ARGV beahviour may be
based upon it. Also, as I already said, in Perl6 users could be allowed
further degrees of customizability.
Michele
--
>> try sleeping on it, that usually works.
> I think you're right. Usually it works every time. ;-)
I don't know about that.
I tried sleeping on a big big problem and we're now divorsed.
- "Tralfaz" on sci.math, "Re: About a big big problem" (edited)