chop up code

if $test = "this is a test file"
(words seperated by spaces)
how do i make
i tried
($var1,$rest)=split(" ",$test);
($var2,$rest1)=split(" ",$rest1);
etc....but it just works for the first two values....
Who is Participating?
mjswartConnect With a Mentor Commented:
Try using
($var1, $var2, $var3, $var4, $var5) = split(" ",$test);

or better
@var = split(" ",$test)

after the second suggestion you would have to refer to your variables like: $var[0] $var[1] $var[2] etc...

All Courses

From novice to tech pro — start learning today.