in reply to Re^4: Perl Errors
in thread Perl Errors

What? I smell heresy in the Monastery! Cleanse the Xenos, Burn the Witch, Purge the Heretic!

Always use strict; If you see uncleanliness you can do two things: clean it up or stab out your eyes so you do not see it anymore. Your choice.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

Replies are listed 'Best First'.
Re^6: Perl Errors
by Hellhound4 (Novice) on Mar 27, 2012 at 21:59 UTC
    So if I want global variables I need to use MAIN::Variable_Name = whatever ok a few questions. Do I have to supply a value when I declare it? Do I have to refer to it as MAIN::Variable_Name or will Variable_Name work? Can I call it within other blocks? And in my full code is there any reason it would fail to open the directory?

      Short answers:

      1. No.
      2. No
      3. (Usually) the latter
      4. You don't generally "call" a variable, but if you mean can you make use of it, yes
      5. Several

      This series of questions practically begs for a near-complete Perl tutorial. It seems that's what you need. So please read some documentation; a book; or examples of working code here in the Monastery, rather than jumping to unwarranted conclusions.

        I withdraw this post and replace with: You were right. Reading a basic tutorial and paying attention to chomp would help. Sorry I'm not used to /n being auto included. Usually I have to tell the program to start a new line.