Perl has a bunch of tools that can help you. For starters, always start your code with the shebang line:

#!/usr/env/perl

Next, always use strictures---something like this:

#!/usr/env/perl use strict; use warnings; use diagnostics;

Next, you can run your script using the perl debugger

perl -d yourscript.pl

The debugger will start the script and a prompt will popup. At the prompt, enter the first line of code

x my $data = "clients.dat";

Something like 'clients.dat' will come back, so there's the first error: "clients.dat" should be 'clients.dat'. Be sure to use x my $data = "clients.dat" because the "x" will make it correct the mistake for you. If you just enter "my $data = "clients.dat"", then nothing will happen. Pretty simple, no? Enter each line thru the end of the script.

Next, you'll want to straighten-up your code, make it prettier so to speak. Download and install Perl::Tidy. Then from the command line: perltidy yourscript.pl

Lastly, since you are new to Perl, you'll want to download and install Perl::Critic. Then enter on the command line:

perlcritic yourscript.pl

Be sure to check the documentation. There's a lot that you can do with perlcritic, and it will definitely help you.


In reply to Re: An REAL array of hashes by Khen1950fx
in thread An REAL array of hashes by fseng

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.