Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Why use warnings? -w

by alexander_lunev (Pilgrim)
on Feb 22, 2018 at 05:47 UTC ( [id://1209717]=note: print w/replies, xml ) Need Help??


in reply to Why use warnings? -w

I think that to use strict is a good programming practice, like sane variable naming, not using gotos and all of that. Just yesterday I found that debugging script without use strict is long and painful. Consider this typo in a more than 1000 lines of code script:

my $places_labels = {}; # .... about 100 lines skipped while (my $p = $i->next) { $place_labels->{$p->id} = $p->name; }

All you need to find such typo is to use strict.

Perl, like Unix, will not stop you to shoot your own foot. You may not use strict if you know what you're doing.

Warnings is similar to strict. If you want to make fast and ugly code that just works and hear no complains from perl - just don't enable them.

Replies are listed 'Best First'.
Re^2: Why use warnings? -w
by karlgoethebier (Abbot) on Feb 22, 2018 at 17:49 UTC
    "...not using gotos..."

    It depends. See Re^2: A meditation on the naming of perl6 ;-)

    Best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

      I don't see why you need goto there ;)

      #!/usr/local/bin/perl -w use strict; use warnings; use feature qw(say); $SIG{INT} = sub { die q(Nuff said!); }; say q(Did you post some valid code today?); my $answer; while (not defined $answer) { chomp( $answer = <STDIN> ); $answer = lc $answer; my %dispatch = ( 'yes' => sub { say q(Good!) }, 'no' => sub { say q(Bad!) }, 'nada' => sub { say q(Answer yes or no!); undef $answer; } ); ( $dispatch{$answer} || $dispatch{nada} )->(); }
        "...you need goto there"

        Yes sure. In dubio pro reo. Let's assume that it's a TIMTOWTDI.

        Best regards, Karl

        «The Crux of the Biscuit is the Apostrophe»

        perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-23 06:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found