David --- Senior Programmer Analyst --- Wgo Wagner wrote: > > #!perl -w > use strict; > > my @MyWorka = (); > my $In = 0; > my $MyItem1 ; > my $MyItem2 ;
There is no reason to declare these variables with file scope as they are only used inside the while loop. > my $MyMaxLen = 35; > > while ( <DATA> ) { > chomp; > next if ( /^\s*$/ ); > if ( /^\s+>(\S+)/ ) { > $MyItem1 = $1; my $MyItem1 = $1; > chomp($MyItem2 = <DATA>); chomp( my $MyItem2 = <DATA> ); > $In++; What does this do? It isn't used anywhere else. > $MyItem2 =~ s/\s+//g; > my $MyLen = length($MyItem2); > if ( $MyLen < $MyMaxLen ) { > my $MyExtra = $MyMaxLen - $MyLen; > $MyItem2 .= sprintf "%s", '-'x$MyExtra; The use of sprintf is a bit redundant. $MyItem2 .= '-' x $MyExtra; > } > @MyWorka = split(//,$MyItem2); > printf "%-2s"x$MyMaxLen , @MyWorka; > printf "\n%-s\n\n", > $MyItem1; No need for printf here. print join ' ', @MyWorka; print "\n$MyItem1\n\n", > } > } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]