in reply to Re^2: Reading File Into Array
in thread Reading File Into Array

I think i realised this after your message . What i was think of as an array was in fact a list ?. I changed my code accordingly and it worked
sub read_file { @lines = <>; chomp(@lines) ; $oldlines = join (',',@lines); $oldlines =~ s/,/\n/xg; print $oldlines; } &read_file;

Replies are listed 'Best First'.
Re^4: Reading File Into Array
by ww (Archbishop) on Mar 28, 2016 at 10:31 UTC

    I'm still not clear about your understanding of lists and arrays, but this is definitely an improvement. However, please note, the ampersand in the subcall is unnecessary... and unwise. Super Search will reveal many explanations.