Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

(jeffa) Re: macls.pl

by jeffa (Bishop)
on Jun 06, 2001 at 22:15 UTC ( [id://86330]=note: print w/replies, xml ) Need Help??


in reply to macls

Very small critisms that go a long way:
  1. Instead of using $DEBUG as a variable, why not 'declare' it as a constant:
    use constant DEBUG => 0;
  2. Testing if something is equal to "1" is overkill, all you need to know is if the variable is non-zero or not. Both of these are equal in consequence:
    print gmtime($object) ."\n" if $DEBUG == "1"; print gmtime($object) ."\n" if $DEBUG; # ahem, but since we'll be using the constant DEBUG print gmtime($object) ."\n" if DEBUG; # sorry i didn't mention this ea +rlier
  3. last issue, your first for loop:
    for ( @filename ) { my $filename = $_; ... }
    can be more consisely written as:
    for my $filename (@filename) { ... }
Other than that, it works, and that's the most important thing, right? :)

Jeff

R-R-R--R-R-R--R-R-R--R-R-R--R-R-R--
L-L--L-L--L-L--L-L--L-L--L-L--L-L--

Replies are listed 'Best First'.
Re: (jeffa) Re: macls.pl
by snafu (Chaplain) on Jun 06, 2001 at 22:42 UTC
    Hey Jeffa,
    FYI, the constantness of the variables, once set, seems to mean that I don't have to use a '$' to reference a token. Instead, I should reference a constant token all by itself e.g. DEBUG vs $DEBUG
    use constant DEBUG => 0; if ( DEBUG ) { ... } # RIGHT if ( $DEBUG ) { ... } # Wrong

    Once, I figured this out using perldoc constant all worked very nicely. Thanks again for your input.

    ----------
    - Jim

Re: (jeffa) Re: macls.pl
by snafu (Chaplain) on Jun 06, 2001 at 22:23 UTC
    Oh man!! That is great! I didn't know I could create a for loop like that (similar to shell). Thanks for that bit of info.

    As for the $DEBUG...well, I didn't know I could do that either! =P That would make this much cleaner. I will make the changes. Thanks for the information.

    Yup...it works. I really like it. It has been a very helpful tool to me in my work. Thanks for the info Jeff. Talk at ya later.

    ----------
    - Jim

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://86330]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 21:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found