Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: perl 5.005_03 woes

by Limbic~Region (Chancellor)
on Aug 07, 2003 at 18:27 UTC ( #281987=note: print w/replies, xml ) Need Help??


in reply to perl 5.005_03 woes

the_slycer,
In addition to the proper de-referencing that liz illustrates, you are using $a as an unscoped global. You should avoid using $a and $b as variable names as they are used by Perl for sorting. See perldoc -f sort. It should then be properly scoped with my or *gasp* our if you really need it to be global.

Welcome back - L~R

Replies are listed 'Best First'.
Re: Re: perl 5.005_03 woes
by freddo411 (Chaplain) on Aug 07, 2003 at 22:54 UTC
    If my memory serves me correctly, couple of things to be aware of:
    • 5.005.03 doesn't do "our"; use use vars instead
    • 5.005.03 doesn't do like use warnings; use /my/perl -w instead

    -------------------------------------
    Nothing is too wonderful to be true
    -- Michael Faraday

Re: Re: perl 5.005_03 woes
by the_slycer (Chaplain) on Aug 07, 2003 at 19:35 UTC
    Yah, I knew/know the $a/$b bit actually (should have thought before posting), I never use either in production code. Was just making it simple for someone that was testing it for me. I always use warnings; use strict; (there was another "forgotten" surprise from that btw :) ).
      the_slycer,
      Actually I assumed you did have:
      #!/usr/bin/perl -w use strict;
      In the small snippet you showed on 5.6.1 you would not have encountered any problems. That is why I didn't specifically mention them. This is because the strict pragma ignores $a and $b since Perl uses them to allow you to build a custom sort routine.

      Cheers - L~R

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2020-07-07 23:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?