in reply to Re: Print not printing
in thread Print not printing
$a and $b aren't that special. The sort built-in uses their package versions (try the code below in main:: to see if it still works), but that's as magical as they get. They otherwise act like any other package variable, and you don't have to be afraid of them. I'd stay away from them because they aren't descriptive variable names.
#!/usr/bin/perl -l package Foo; $, = " "; print sort { $Foo::a <=> $Foo::b } qw( 1 7 2 0 4 3 6 );
In your sort call within the foreach, you don't need an argument. :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Print not printing
by mrpeabody (Friar) on Jun 24, 2005 at 19:20 UTC | |
|
Re^3: Print not printing
by anonymized user 468275 (Curate) on Jun 27, 2005 at 10:01 UTC |