in reply to what does my ($subdir, @keywords) = split; do.
I understand that split creates an array from a stringNo, split creates a list.
What is the difference between a list and an array?
So @array = split(/\s+/, $_) splits the $_ varible at whitespaces and places the results in array. @array =split does the same.No, split with no arguments does something similar but not quite the same as split( /\s+/, $_ ). You will only notice the difference if the string in $_ has leading whitespace.
my ($subdir, @keywords) = split; assigns the list returned from split to the list in the parentheses. If any of the variables in the parentheses is an array or a hash it will receive the remaining items in the list and any variables following said array or hash will not receive anything. This is all explained in the documentation.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: what does my ($subdir, @keywords) = split; do.
by richill (Monk) on Mar 20, 2006 at 22:59 UTC |