String found where operator expected at



  • $ ./myperl1 
    String found where operator expected at ./myperl1 line 3, near "say "Hello, Universe""
    	(Do you need to predeclare say?)
    syntax error at ./myperl1 line 3, near "say "Hello, Universe""
    Execution of ./myperl1 aborted due to compilation errors.
    

    I found that you have to specific the version of perl you are using in the script, to tell perl that the say.pm module is available with that version. Adding the second line worked.

    #!/usr/bin/env perl
    use v5.22;
    say "Hello, Universe";
    

Log in to reply
 

© Lightnetics 2024