@small = grep { $_->size < 100 } sort $query->all_records; # vs. @small = sort grep { $_->size < 100 } $query->all_records; #### ($short) = $desc =~ /^(.{0,100})/; # breaks on embedded newlines, and is better as $short = substr($desc, 0, 100); #### $name = substr($rec, 0, 20); $age = substr($rec, 20, 5); $job = substr($rec, 25, 25); # repeated calls to substr() better as unpack() ($name,$age,$job) = unpack 'A20 A5 A25', $rec; #### if ($str =~ /jeff/) { ... } # why not if (index($str,'jeff') > -1) { ... } # or if you know that if it's there, it's toward the end: if (rindex($str,'jeff') > -1) { ... } #### # (on average) s/[abc]*//g; # is FAR slower than s/[abc]//g; # is slower than s/[abc]+//g; # which is slower than tr/abc//d;