PerlingTheUK has asked for the wisdom of the Perl Monks concerning the following question:
This seems to be a bit too complicated to me. Any suggestions to improve this?my @lines = ( "??????????????", "123" ); my $conv; for my $line ( @lines ){ if length( $line > 6 ){ $conv = substr( $line, 0, 6 ); } else { $conv = sprintf( "%6s", substr( $line, 0 ) ); } # do something with $conv; }
|
|---|