View Single Post
Old 10-21-2008   #1 (permalink)
Andy


 
 

Looking for something better than split and join

I have a string that looks like "/vol/InfraDev_AppDev03/VHD.lun"
I need to do something so I can get

$vol = "/vol/InfraDev_AppDev03/"
$lun = "VHD.lun"

My first solution (which works but I just think its not so elegant)
is to split the string on "/" and then do a join on "/" with the first
two elements in the result of the split and set that to $vol, and then
leave the third element as $lun.

I am no regex kung fu master, but I was wondering if there was a
slightly more elegant way to solve this problem.

Thanks,

Andy
My System SpecsSystem Spec