Home: Perl Programming Help: Intermediate:
Post deleted by $_



$_
Novice

May 18, 2009, 11:11 AM


Views: 5237
Post deleted by $_

 


FishMonger
Veteran / Moderator

May 18, 2009, 11:51 AM


Views: 5233
Re: [$_] printf display order

I'm unable to duplicate your issue.

Code
[root@fc4dev ~]# cat test.pl 
#!/usr/bin/perl

use strict;
use warnings;

my %resolved = ('device.netserv.ch' => 1,
'isp.belgacom.be' => 11,
);

$| = 1;

my $total = 0;

for (sort { $resolved{$b} <=> $resolved{$a} } keys(%resolved))
{
$total += $resolved{$_};
printf "%5d \t%s\n", $resolved{$_}, $_;
}

printf "-----\n%5d\n", $total;


Code
[root@fc4dev ~]# ./test.pl 
11 isp.belgacom.be
1 device.netserv.ch
-----
12
[root@fc4dev ~]# ./test.pl
11 isp.belgacom.be
1 device.netserv.ch
-----
12
[root@fc4dev ~]# ./test.pl
11 isp.belgacom.be
1 device.netserv.ch
-----
12
[root@fc4dev ~]# ./test.pl
11 isp.belgacom.be
1 device.netserv.ch
-----
12
[root@fc4dev ~]# ./test.pl
11 isp.belgacom.be
1 device.netserv.ch
-----
12
[root@fc4dev ~]# ./test.pl
11 isp.belgacom.be
1 device.netserv.ch
-----
12
[root@fc4dev ~]# ./test.pl
11 isp.belgacom.be
1 device.netserv.ch
-----
12


Can you post a complete example, as I did, of the issue?


KevinR
Veteran


May 18, 2009, 4:01 PM


Views: 5228
Re: [$_] printf display order


In Reply To
I know and used Perl for a long time - while I'm not a specialist.
Now, there is this behavior that I don't understand
.
.
.
I don't see any obvious reason. Thanks for helping.


I can't see any reason why that would happen either.
-------------------------------------------------


$_
Novice

May 18, 2009, 11:48 PM


Views: 5220
Re: [FishMonger] printf display order

No way to delete the whole thread :(
The output was actually piped to a sort through an alias...
Sorry didn't see that initially!


KevinR
Veteran


May 19, 2009, 9:37 AM


Views: 5216
Re: [$_] printf display order


In Reply To
No way to delete the whole thread :(
The output was actually piped to a sort through an alias...
Sorry didn't see that initially!


There is no reason to delete the thread. The problem you had and the eventual cause might help another person in the future that faces a similar situation.
-------------------------------------------------