in reply to chomp - reference
looks like it works, maybe there is some other piece of code that isn't shown? perhaps try s/\s*$//; to get rid of ALL white space at the end of line.#!/usr/bin/perl -w use strict; my @a = ( "asdfadsf df\n", "qrwtqtre ab\n"); my $ref = \@a; print "simple print\n"; foreach my $line (@a) { print $line; } print "\nnow with chomp\n"; foreach my $line (@$ref) { chomp $line; ## this modifies @a print "$line**"; } print "\nnow again simple print\n"; foreach my $line (@a) { print $line; } __END__ simple print asdfadsf df qrwtqtre ab now with chomp asdfadsf df**qrwtqtre ab** now again simple print asdfadsf dfqrwtqtre ab
|
|---|