programming-examples/perl/File/Apply chomp to all elements of an array.pl

12 lines
254 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!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.";