On Monday, May 20, 2002, at 10:43 , Peter Scott wrote:
[..]
> At 10:25 PM 5/20/02 -0700, drieux wrote:
[..]
>>>         print while <>;
>>
>> I thought that was a synonym for STDIN?
>
> Only in certain cases.  It iterates over @ARGV; it's special.  Look under 
> "I/O Operators" in perlop.

"Well DAMN!"
        - will smith in M.I.B

a) I didn't know that... I should have expected that this was
one of the overloaded operators....

b) I'm not sure I would use it in demonstration code where
I am trying to help someone make the cross over from shell
scripting to perl - since writing transparently readable
code that has variables called out that say mostly what
they are about - or takes a 'twist' or 'pun' on their use -
I feel may help most folks over the hump of the camel.

{ there is the struggle to teach both the syntax and semantics
of perl - as well as the underlying issues of software development
as a psychosis - which are at times almost mutually exclusive ...
Too many 'neato/cool' things that 'can be done' can get in the
way - since there is a need to help folks understand what coding
is all about.... }

c) I of course would avoid that in 'production code' on the
grounds that I would be going through Getopts::Long - so
that all of that is nicely returned to me in a pretty hash
and can be cleanly sucked out as I expect it. Hence I would
have iterated the list of files with something on the order of

        for (@$opHash{'files'}) {
                # deal with the list of files
        }

Were I expecting that a 'list' were to be generated....
We had a stock cookie cutter getOurArgs sub that we used
to encapsulate all of that...

ciao
drieux

---
  the perldoc dope:

        " The @ARGV array is then processed as
        a list of filenames.  The loop

            while (<>) {
                ...                     # code for each line
            }

        is equivalent to the following Perl-like pseudo code:

            unshift(@ARGV, '-') unless @ARGV;
            while ($ARGV = shift) {
                open(ARGV, $ARGV);
                while (<ARGV>) {
                    ...         # code for each line
                }
            }
        "


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to