#!C:/perl/bin/perl.exe use strict; use warnings; my @tmp_oid = (); while() { 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