in reply to Re: Simple file to array
in thread Simple file to array
When using a filehandle in list context (such as assigning it to an array), each line is treated as a list element and assigned to the array just like if you were doing my @email_addys = ('x@y.com', 'foo@bar.org', ... ).
One of the problems here is that this doesn't strip the linefeed character from the end of each line, so that what we end up with is an array like ("x@y.com\n", "foo@bar.org\n") when reading this from a file. We probably want to clean up the array, which we can do quickly with for( @email_addys ){ chomp }; at some point after the assignment.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (ichi) re x 2: Simple file to array
by fruiture (Curate) on Jul 08, 2002 at 19:42 UTC | |
by ichimunki (Priest) on Jul 08, 2002 at 19:52 UTC |