提取字符串

提取字符串

$str=inet 121.227.21.222 peer 202.111.33.26/32 scope global ppp0
$addr=(split /\s+/,$str)[-4];
这个时候addr等于202.111.33.26/32 ,其实我想要的结果只是202.111.33.26,也就是要把后面的/32去掉,请问怎么做,望大哥帮下忙!谢谢!
急等!
谁帮看下呢!?
#!usr/bin/perl -w


$str="inet 121.227.21.222 peer 202.111.33.26/32 scope global ppp0";
$addr=(split /\s+/,$str)[-4];
$addr=(split /\// ,$addr)[0];
print $addr;
高手指教一下呢!?
谢谢大哥!呵呵!
$st r= 'net 121.227.21.222 peer 202.111.33.26/32 scope global ppp0';
($addr) = $str =~ m{([.\d]+)/\d+};
print $addr