use strict; my @words; my $banner; my @array; my $i = 0; my @strings; my @test; open RI,") { if (/^printer/) { # IF ARRAY IS NOT EMPTY if ( @array ) { for ( sort { $a->[1] <=> $b->[1] } @array ) { print "$_->[0]|"; } print "\n"; @array=(); $i =0; } @strings = (split)[1,3,4,5]; if ( $strings[1] eq "idle." ) { push @array, [ "0", 6 ]; } else { #QUEUE JOBS #my $number = `lpstat -o $strings[0] | wc -l | sed -e 's/^ *//'`; #chomp($number); #push @array, [ $number, 6 ]; } # if ( $strings[2] eq "enabled" ) { my $s = "Up"; push @array, #+[ $s, 5 ]; } # if ( $strings[3] eq "enabled" ) my $s = "Up"; push @array,+[ $s, 5 ]; push @array, [ $strings[0], 1 ]; #$strings[0] is the name of printer } # END OF /PRINTER/ elsif (m|Interface:(.+)|i) { @words = split(/\//, $_); chomp($words[-1]); push @array, [ $words[-1], 3]; } elsif (m|Description: (.+)|i) { push @array, [ $1, 4]; } elsif (m|Connection: (.+)|i) { if ($1 eq "direct" ) { push @array, [ "Local", 2]; } } elsif (/Banner not required/) { # push @array, ["No",7 ]; # $banner=`awk -F '/^BANNER/ { print $1 }' /etc/lp/interfaces/$strings[0] | sed 's/ *# CHANGE BANNER PAGE PRINTING//'`; chomp($banner); if( $banner eq "BANNER=\"\"") { push @array, ["No",7 ]; } elsif( $banner eq "BANNER=\"yes\"") { push @array, ["yes",7 ]; } else { push @array, ["no",7 ]; } } }#END OF WHILE LOOP for ( sort { $a->[1] <=> $b->[1] } @array ) { print "$_->[0]|"; } print "\n";