Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: question on declaring variables

by toolic (Bishop)
on Nov 22, 2018 at 12:03 UTC ( #1226177=note: print w/replies, xml ) Need Help??


in reply to question on declaring variables

Yes, the declaration is the same for both files, but $a is a special variable, whereas $x and $y are not. You get the error messages because you correctly use strict:
Because of their special use by sort(), the variables $a and $b are exempted from this check.
You should avoid using $a and $b because they are special for the sort function. As the helpful message reports, you need to declare x and y with my.

Replies are listed 'Best First'.
Re^2: question on declaring variables
by badbanana (Novice) on Nov 22, 2018 at 12:15 UTC
    oh i see. thanks, got it!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2020-10-26 07:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (250 votes). Check out past polls.

    Notices?