Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^2: My first USEFUL script!

by nefigah (Monk)
on Mar 05, 2008 at 05:16 UTC ( #672092=note: print w/replies, xml ) Need Help??

in reply to Re: My first USEFUL script!
in thread My first USEFUL script!

Most appreciated :)
  • strict/warnings: I actually had those in the original script; as they are a part of the template that I set up for creating a new script (along with the shebang line and some #created on comments), I didn't copy and paste them. But I agree :D
  • $_: I'd been pointed to a general rule of thumb that explicitly saying $_ was to be avoided when possible (although that it is probably okay in grep/map). Glad to know there is some varying opinions on this though!
  • glob: Roger, I'll keep that in mind--is it faster or something?
  • blocks: Will keep that in mind as well
  • Renaming: I'll go back and take out the dot--it does make more sense. As to OS tools breaking, I think I'll go ahead and see what happens. I can always put the originals back in place if stuff is being weird. Thank you for the word of caution :)
The rating scale tends to be easy use for the extreme ends of the scale, which is what I was concerned with ;) Thank you for looking this over!!

Replies are listed 'Best First'.
Re^3: My first USEFUL script!
by ikegami (Pope) on Mar 05, 2008 at 06:51 UTC
    Explicitly saying $_ is to be avoided when possible since you might as well as a meaningful variable name instead. However, that's obviously not the case when map/grep sets $_ for you.
Re^3: My first USEFUL script!
by Tanktalus (Canon) on Mar 05, 2008 at 14:46 UTC

    glob is more clear in general. For example, what does <FILE> do? Does it read a line (or all lines in list context) from the global filehandle 'FILE'? Or does it do a glob of 'FILE' in the current working directory? How about <$fh>? If $fh is "/usr/bin/perl*"? How about if $fh is an IO::File object? Or a reference to a global filehandle? If you want a glob, just use the glob function. That's what the <> does under the covers anyway.

    As for "stuff being weird" - you may not notice for 6 months... and by then you'll have forgotten that you replaced the system perl, and will beat your head against a wall trying to fix it ;-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://672092]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2018-05-22 12:55 GMT
Find Nodes?
    Voting Booth?