in reply to Chomp not working

Path::Tiny has chomp option :) also "or dies" on error ... here is pretty much the same code
#!/usr/bin/perl -- use strict; use warnings; use Path::Tiny qw/ path /; my @lines = path( "splitin.pl" )->lines( { chomp => 1 } ); s/\s+$// for @lines; ## extra "chomp", trim trailing whitespace s/^\s+// for @lines; ## trim leading whitespace @lines = grep /^\$outcome /x, @lines; @lines = map { substr( $_, 10, -2 )."\n" } @lines; path( "output.csv" )->spew( @lines ); undef @lines;