in reply to ead a file which has three columns and store the content in a hash
my ($first, $second, $third) = split ' ', $line;
If you don't want to populate a variable that's never used, either replace it with undef in the assignment:
my ($first, undef, $third) = split ' ', $line;
or extract only the columns you're interested in using a list slice subscript:
my ($first, $third) = (split ' ', $line)[0, 2];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Split a column
by shabird (Sexton) on Apr 13, 2020 at 16:35 UTC | |
by Fletch (Bishop) on Apr 13, 2020 at 16:51 UTC | |
by choroba (Cardinal) on Apr 13, 2020 at 17:08 UTC | |
by shabird (Sexton) on Apr 13, 2020 at 17:45 UTC | |
by Fletch (Bishop) on Apr 13, 2020 at 18:03 UTC | |
by choroba (Cardinal) on Apr 13, 2020 at 18:00 UTC | |
by AnomalousMonk (Archbishop) on Apr 13, 2020 at 18:44 UTC |