Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
That produces this error:#!C:/perl/bin/perl.exe use strict; use warnings; my @tmp_oid = (); while(<DATA>) { chomp; my $last_oid = $_; if ($#tmp_oid < 2) { push @tmp_oid, $last_oid; } else { my $first_oid = shift @tmp_oid; if ( (pack("C*", split('\.', $first_oid)) cmp pack("C*", split +('\.', $last_oid)) ) > 0 ) { print "Sort needed\n"; } push @tmp_oid, $last_oid; } } __DATA__ 1.3.6.1.2.1.7.5.1.1.0.0.0.0.1020 1.3.6.1.2.1.7.5.1.1.0.0.0.0.1021 1.3.6.1.2.1.7.5.1.1.0.0.0.0.1022 1.3.6.1.2.1.7.5.1.1.0.0.0.0.1023 1.3.6.1.2.1.7.5.1.1.0.0.0.0.701
My method seems to work correctly determining that a sort is required but why am I seeing this error? If I shorten the OIDs I don't see the error ???Character in 'C' format wrapped in pack at sort.pl line 16, <DATA> lin +e 4. Character in 'C' format wrapped in pack at sort.pl line 16, <DATA> lin +e 4. Character in 'C' format wrapped in pack at sort.pl line 16, <DATA> lin +e 5. Character in 'C' format wrapped in pack at sort.pl line 16, <DATA> lin +e 5. Sort needed
2006-01-18 Retitled by g0n, as per Monastery guidelines
Original title: 'Sorting Question'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: pack() format error.
by dave_the_m (Monsignor) on Jan 17, 2006 at 20:34 UTC | |
by Anonymous Monk on Jan 17, 2006 at 20:41 UTC | |
|
Re: pack() format error.
by japhy (Canon) on Jan 17, 2006 at 20:37 UTC | |
|
Re: pack() format error.
by blazar (Canon) on Jan 18, 2006 at 08:28 UTC |