Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

The code you posted will not trigger that message. It will trigger other error messages, however.

The first problem, assuming you're on an operating system that respects shebang lines, will be:

bash: ./mytest.pl: /usr/bin/perl-w: bad interpreter: No such file or d +irectory

...or something similar. This is because your code has no space between "perl" and "-w", so the shell will go looking for a program named "perl-w", which probably doesn't exist.

The second problem will be that you are using a variable, "$name", without declaring it, which is a violation of "use strict;". You should use strict, but you should not use it without knowing what it does. The message the strict violations will give is this:

Global symbol "$name" requires explicit package name at mytest.pl line + 5. Global symbol "$name" requires explicit package name at mytest.pl line + 7. Execution of mytest.pl aborted due to compilation errors.

You should probably start by reading a good book like OReilly's "Learning Perl". perlintro, perlsyn, and strict will probably give you everything you need to get this code running, but a book like Learning Perl will give a kinder, gentler introduction.

In the future, I recommend posting the exact code that produces the exact error message you're describing. The error message you are describing is totally unrelated to the code you posted.

Also, your write-up formatting was totally messed up; I fixed it for you. Writeup Formatting Tips will explain how to format posts here.

Welcome! It's fantastic that you want to learn Perl. I hope you pick up a good book and really dig into it. We need more newcomers to the language. But please, do it right. Don't just guess at things.

Now get started in the process. ;)


Dave


In reply to Re: beginner's question by davido
in thread beginner's question by perl_Gu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-25 22:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found