I was up late last night trying to figure out an ugly... it has always bugged me that
#!/usr/bin/perl open something, ">/dev/null"; print something "happilly\n"; # then close something; #back up...
works fine, but once I put in
#!/usr/bin/perl -w use strict;
perl starts complaining... I used to try to put quotes in there
open "something", ">/dev/null";
but that was foolish... I finnally found out that the real solution is to use capital letters (especially at the beginning of the file handle)... Though I don't remember--but for a vague memory--any documentation to the effect. Well, I'm nolonger pester'd. :) And my new pleasure on to you.
#!/usr/bin/perl use strict; open ThisWorksGreat, ">/dev/null";

Replies are listed 'Best First'.
RE: pester'd
by redmist (Deacon) on Jul 29, 2000 at 17:07 UTC
    Welcome to the wonderful World of Pragma. It's a Good Thing. As you continue in your quest to learn more about Perl, there will be more things to remember about convention, readability, and other such issues. One issue with the snippet above is that in order to adhere to convention, you will want to make filehandle names all caps and have an or die thingamagig when you open a file(handle). Another thing to improve readability (at least to me) is to use parentheses in open statements. Like this:

    open(FOO, "foo.txt") or die "Couldn't open foo.txt: $!";

    Pragma GOOD! Have fun.

    redmist
    redmist.dyndns.org
    redmist@users.sourceforge.net