in reply to Re: result is not listening to if
in thread result is not listening to if

Hi! The thing is in the book they don't use it in the examples and the exercises they only use "warnings;" So I thought "ok, saves me some typing". I wanted the max string length to be 100 yes. Ok thanks for the advice !

Replies are listed 'Best First'.
Re^3: result is not listening to if
by hippo (Archbishop) on Jul 14, 2017 at 14:11 UTC
    So I thought "ok, saves me some typing".

    Easy mistake to make. Instead you should have thought "ok, I'll program my editor to auto-insert those in every Perl file I create".

      I haven't gotten that far yet, I use Visual Studio Code, I will need to check where I can do that.

        "...I'll program my editor..." hippo

        hippo is almost always right. An example for emacs as real monks use emacs, you know ;-)

        ; $Id: perl-skeleton.el,v 1.2 2017/07/14 17:13:34 karl Exp karl $ (define-skeleton perl-skeleton "...soft like butter, fits like a glove...." (nil) "#!/usr/bin/env perl\n\nuse strict;\nuse warnings;\n\n\n__END__\n") (global-set-key [f6] 'perl-skeleton)

        Load the file with:

        M-x load-file Load file: ~/path/to/perl-skeleton.el

        Create a new file with C-x C-f and then f6 - or what ever your binding is and you get:

        #!/usr/bin/env perl use strict; use warnings; __END__

        Best practice is to put the code from perl-skeleton.el in your .emacs file.

        Unfortunately i don't know a solution for your favorite tool, but i'm sure that there is something similar.

        Best regards, Karl

        Minor update: Changed path to the elisp file

        Update: Possibly a little nice/helpful addendum:

        «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

Re^3: result is not listening to if
by Anonymous Monk on Jul 14, 2017 at 13:49 UTC
    The strict thing is kind of a sore point here in the Monastery. The Learning Perl people don't teach it because that saves them a little bit of explanation in their beginner classes. But then their students show up here with problems that would have been caught by strict and we have to straighten them out.