Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: How many man-hours would you estimate you have invested in learning Perl?

by mithaldu (Monk)
on Apr 09, 2013 at 12:46 UTC ( #1027723=note: print w/replies, xml ) Need Help??


in reply to Re: How many man-hours would you estimate you have invested in learning Perl?
in thread How many man-hours would you estimate you have invested in learning Perl?

Let me teach you something else. :)

#!/usr/bin/perl -w is not something you should use. Specifically the -w in there will enable warnings for ALL code, which can include modules which were expressly written to run correctly without warnings (like Coro).

A better preamble would be:
#!/usr/bin/env perl use strictures;
Happy coding! :D

Replies are listed 'Best First'.
Re^3: How many man-hours would you estimate you have invested in learning Perl?
by DrHyde (Prior) on Apr 17, 2013 at 12:03 UTC

    #!/usr/bin/env perl isn't portable, as not all platforms have env in the same place. You should use this instead:

    #!/bin/sh exec perl -x $0 "$@" #!perl # your perl code goes here
Re^3: How many man-hours would you estimate you have invested in learning Perl?
by blue_cowdawg (Monsignor) on Apr 09, 2013 at 13:59 UTC
        #!/usr/bin/perl -w is not something you should use. Specifically the -w in there will enable warnings for ALL code, which can include modules which were expressly written to run correctly without warnings (like Coro).

    Not sure I follow your argument. I want warnings turned on. It has saved my butt many a time and yes I'm aware of the drawbacks.


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

      Sure, you want warnings turned on... for your own code. That's what use warnings is for.

      Why would you want to use a global setting to cause other modules to throw warnings even though they are operating as intended? (as in the example)

        For one example, "-w" catches all kinds of data errors, from premature EOF to non-numbers where you expect numbers, when you pass a file handle to someone else's code. You'll get false positives, but you will also get a hint where the problem lies when you are getting unexpected results. Fix the ones you care about, remove the "-w" when you're done, and there you go. Monstrosities like "strictures", which turn on all warnings but only in your code, will not only miss these errors, but complain about non-problems.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1027723]
help
Chatterbox?
[jdporter]: ok, I need a recipe for piping lines "through" an external program which is itself a filter
[jdporter]: without using a tmp file
[1nickt]: tobyink perl -MTypes::Standard= is_Int -Mstrict -wE 'say 1 if is_Int 1.0'
[jdporter]: so that I can use the existing expand unix util. Otherwise, I'll probably use Text::Tabs.
[1nickt]: pryrt I guess I don;t really care if user 42 logs on as 42.0 ... more of an academic question at this point.
[LanX]: jdporter: open PIPE,'-|' ?
[LanX]: oh you want the result line by line?
[jdporter]: ok, LanX, then what?
[jdporter]: It doesn't have to be line by line. Just "my program" "writes" to the external prog and also/then "reads" from it.
LanX open (You are not allowed to open to a command that pipes both in and out, but see IPC::Open2, IPC::Open3, and Bidirectional Communication with Another Process in perlipc for alternatives.)

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (13)
As of 2017-05-24 20:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?