Link to home
Start Free TrialLog in
Avatar of paulwhelan
paulwhelan

asked on

split up text

if my variable contains
$myvar="this=is=a=test=string";

and i do
($x,$y)=split("=",$myvar);

then $x becomes "this"
and $y becomes "is"

but how do i split it so that
$x becomes "this"
and $y becomes "is=a=test=string";

ie $y becomes the rest of the string

thanks
ASKER CERTIFIED SOLUTION
Avatar of maneshr
maneshr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mrachow
mrachow

There is a thirt parameter for split available.
Try
($x,$y)=split("=",$myvar,2);

Greetings.
Or this:

($x,@y)=split("=",$myvar);
$y=join("=",@y);

Rob
Or this:

($x,$y)=$myvar=~/^(.+?)=(.*)/;

Rob
Avatar of paulwhelan

ASKER

sorry maneshr got there first....
it works thats the main thing
;)