$1
, $2
, $3
, ....
Si no hubiera emparejamiento se retorna la lista vacía.
Si lo hubiera pero no hubieran paréntesis se retorna la lista
(1)
.
1 #!/usr/bin/perl -w 2 $foo = "one two three four five"; 3 ($F1, $F2, $Etc) = ($foo =~ /^\s*(\S+)\s+(\S+)\s*(.*)/); 4 print "List Context: F1 = $F1, F2 = $F2, Etc = $Etc\n"; 5 # This is equivalent to: 6 ($F1, $F2, $Etc) = split(' ',$foo,3); 7 print "Split: F1 = $F1, F2 = $F2, Etc = $Etc\n";Observa el resultado de la ejecución:
> escapes.pl List Context: F1 = one, F2 = two, Etc = three four five Split: F1 = one, F2 = two, Etc = three four five
Casiano Rodríguez León