Getting the argument from the command line is accomplished with the ARGV array,
$input=$ARGV[0];
print "Parameter=\"$input\"\n";
The heart of the program is a loop that finds the first non-word and word tokens,
while ($input ne ""){
$input=~/(\W*)(\w*)/;
. . .
## print "$input\n"; ;
}
exit;
Note that eq and ne are used for string comparison while = and != are used for arithmetic comparisons.
The first set of parenthesis capture the non-word (delimiter) in the $1 variable and the second set of parenthesis capture the word that follows in $2. After printing the delimiter and token, use the substitute command, $input =~ s/???//, to remove the delimiter and token from $input.
Don't take this last step lightly. It seems obvious, but some of you will encounter problems. It is very important that you use the logs to express the ideas going through your mind and the things you tried to make it work.
Test your program with lines like,
perl token.pl "The&&&quick.*.+brown fox%#@$jumped"
and see what happens!!