Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^5: Passing Along Arrays

by 2teez (Vicar)
on Aug 26, 2014 at 21:52 UTC ( [id://1098686]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Passing Along Arrays
in thread Passing Along Arrays

Hi Perl Ally,

Some observations and questions:
In readOnly subroutine, why declare the variable first before assignment? i.e

my @contents; my $filePath; my $file; my $errMsg;
From the usage in the subroutine, you can actually use them straight. At least, if not for anything, it shorten the line of codes to read through.
You really don't have to do explicit close $file; The file should close, when the subroutine returns.
Then in your extractData subroutine, what does $pointerProj variable stand for. It must be a variable defined somewhere in the code?
Suggestion (troubleshooting): Why not print out, what you have in "@projects" before the for-loop, to be sure you are getting desired data first?
NOTE: Since one can't have more information than already provided. One can on speculate.

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^6: Passing Along Arrays
by Perl_Ally (Novice) on Aug 27, 2014 at 13:27 UTC

    Thanks for the attention and suggestion 2teez

    I realize it would be more concise the declare the variables as they come into use (and I prefer the look of it that way myself) but I work in a professional environment (which is why I'm not at liberty to share the entirety of my code with the world wide web) with coding guidelines and conventions. It is convention to declare all variables at the outset to better document the routine.

    $proj and $pointerProj are string variables defined elsewhere and used in the naming convention of the data files.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-25 23:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found