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

Re: unix to perl questions

by 2teez (Vicar)
on Mar 11, 2015 at 23:55 UTC ( [id://1119708]=note: print w/replies, xml ) Need Help??


in reply to unix to perl questions

Hi deyaneria,
Welcome to using Perl Programming Language.

To start with I will advice you always use warnings and strict in your perl program.
Secondly, am sure your perl program as you showed above would not compile to start with. Why? Does perl has "Do" or "do", "While" or "while", "Else" or "else".

I think there is need to write the right syntax, then logic can then be put in the right place.

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Replies are listed 'Best First'.
Re^2: unix to perl questions
by deyaneria (Acolyte) on Mar 12, 2015 at 00:18 UTC
    I tried using the use warnings: use strict; when i first got this version I had errors even with the simple "hello World" program putting them as you suggested. I found I have to put in the first line like this #! /usr/local/bin/perl –w I think it's due to the fact I'm using version v5.18.2.

      The page Use strict and warnings explains how to get your program working under strict. It sounds like in your case the best way to start your scripts would be

      #!/usr/local/bin/perl use warnings; use strict;

      (The -w command line switch is not needed if you use warnings;.)

      If you get errors, please post the exact error messages here; see How do I post a question effectively?

        I did try it again to recreate the error I got. After my first script I had to download somthing for UBuntu. Perhaps it fixed the error or most likely I messed something up when trying to use: use warning; and use strict; before.

        I did do that before when writing a simple hello world script, and it gave me an error on a perfectly good running script. I haven't tried it since I had to add patch to Ubuntu for Perl. However I will give it a shot again. That is why I used the command line script instead.

      ..I tried using the use warnings: use strict; when i first got this version I had errors even with the simple "hello World" program putting them as you suggested...

      How does the error read? Can you show it here?

      If you tell me, I'll forget.
      If you show me, I'll remember.
      if you involve me, I'll understand.
      --- Author unknown to me
        I tried to recreate it for you but it worked fine. I had to do a patch on my UBuntu maybe that fixed it or I did something wrong. Probably the latter.
        I tried to recreate the error. I had to download a something UBuntu maybe it fixed the error but more likely I messed something up with my newbie fumbling. It worked perfectly this time thank you for pushing me to try it again.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-28 11:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found