Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: I'm trying to consolidate my functions into subroutines

by AnomalousMonk (Archbishop)
on May 13, 2017 at 17:44 UTC ( [id://1190216]=note: print w/replies, xml ) Need Help??


in reply to Re: I'm trying to consolidate my functions into subroutines
in thread I'm trying to consolidate my functions into subroutines

Further to the AnonyMonk's post: Peter Keystrokes: Note that the invocation of the  SpecifySeqLengths() function in the OPed code before the definition of the subroutine hides problems that exist in that function definition and that warnings and strict (the latter in particular) would like to bring to your attention. Consider the case of invoking the following function before its definition versus after the definition:

c:\@Work\Perl>perl -wMstrict -le "confuse_the_issue(my $x, my %hash); ;; sub confuse_the_issue { print qq{x: $x}; for $x (keys %hash) { print qq{$x $hash{$x}}; } } " Use of uninitialized value $x in concatenation (.) or string at -e lin +e 1. x: c:\@Work\Perl>perl -wMstrict -le "sub confuse_the_issue { print qq{x: $x}; for $x (keys %hash) { print qq{$x $hash{$x}}; } } ;; confuse_the_issue(my $x, my %hash); " Global symbol "$x" requires explicit package name at -e line 1. Global symbol "$x" requires explicit package name at -e line 1. Global symbol "%hash" requires explicit package name at -e line 1. Global symbol "$x" requires explicit package name at -e line 1. Global symbol "%hash" requires explicit package name at -e line 1. Global symbol "$x" requires explicit package name at -e line 1. Execution of -e aborted due to compilation errors.
In the first case, Perl just gives you a light slap on the wrist, but that doesn't mean you are not already far down the road to Hell.


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1190216]
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: (4)
As of 2024-04-24 12:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found