while (<>) { chomp; substr($_, 24, 0, ' ') if length() > 24; print("$_\n"); } #### perl -i~ -ple "substr($_, 24, 0, ' ') if length() > 24" file