Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Compilation error

by toolic (Bishop)
on Oct 09, 2012 at 16:41 UTC ( #998041=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Compilation error
in thread Compilation error

1. When do I use 'my' before an array and when don't I?
Only when you first declare the array variable.
Does this code '{$a <=> $b}' work with only numbers?
Yes. You want cmp (perlop and sort)
use warnings; use strict; my@array = qw(one two three four five six seven eight nine ten); print "The original array contains - @array \n"; my@sorted = sort {$a cmp $b} @array; print "The sorted array contains @sorted \n";

You should also use "code" tags for your error/warning messages.


Comment on Re^3: Compilation error
Select or Download Code
Replies are listed 'Best First'.
Re^4: Compilation error
by truthseeker66 (Novice) on Oct 09, 2012 at 16:46 UTC
    Thank you, toolic. Happy to join the Monks!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (13)
As of 2015-07-30 11:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls