in reply to Calling Perl Modules

The first is called the indirect syntax and the second is the direct syntax. The direct syntax is preferable over the indirect syntax, and should be used in all cases. The indirect syntax can cause very hard to find bugs in certain situations.

In an unrelated note, you should open your files as so:

my $fh = IO::File->new( '>', $someFile ) or die "Cannot open '$someFile': $!\n";

That will protect against any craziness within the filename and will guarantee that the filename will work on all systems as the OS intends, including preserving whitespace and NULL characters, as appropriate.

Replies are listed 'Best First'.
Re^2: Calling Perl Modules
by CC Em (Initiate) on Apr 08, 2005 at 15:12 UTC
    What then is the difference in interpretation using single quotes and double quotes?
    ('r', $someFile) #vs. ("< $someFile")

    Updated:added code tags

      Double quotes allows variable interpolation. Single quotes don't. See To Single Quote or to Double Quote for a longer discussion of people choosing one over the other, and see which reasons you like better. I posted my opinion there, too, which you can take or leave as you see fit ;-)

      It has nothing to do with single-quotes vs. double-quotes. It has to do with the difference between two-arg open() and 3-arg open().