crimeny! I'm doing a training at work to 
introduce people to perl. In the sequence
of putting together some handouts, I've
learned a thing or two I didn't know before.

first, could someone tell me when did perl start
supporting an open function that handles 3 parameters?
        open ($handle, $mode, $filename);
is this the preferred usage when opening a file now?

second, is using a reference to a filehandle
the preferred way of passing filehandles
around higgly piggly?

        my $fh = \*MYHANDLE;

        open($fh, $read, $name);
        print_next_line($fh);
        close($fh);

        sub print_next_line
        {
                my $handle = shift;
                my $line = <$handle>;
                print "line is $line";
        }

I've seen the first line written like this too:
        my $fh = *MYHANDLE;

what's the difference? advantages/disadvantages?

The scripting I do generally has very basic
file io, so I always used a bare filehandle.
This was always a pain if I wanted to pass
it to a subroutine. I never knew you could
pass it via a reference to a typeglob,
(if that's what \*HANDLE really is.)

will all file IO functions take a reference
like this?

Greg
happy happy joy joy

Reply via email to