Mega Code Archive

 
Categories / Perl / File
 

Apply chomp to all elements of an array

#!usr/bin/perl use warnings; use strict; my @array = ( "One\n", "Two\n", "Three", "Four", "Five\n" ); my $newlines = chomp ( @array );   print "\nWe just removed $newlines newlines from that list!\n"; print "\nThe list is now @array.";