
perl split 字符串切割 一维数组转二维数组
perlsplit字符串切割一维数组转二维数组$aa="hellocherry10.9.9.1inok";如何将$aa的数据"hellocherry10.9.9.1ino...
perl split 字符串切割 一维数组转二维数组
$aa="hello cherry 10.9.9.1 in ok";
如何将$aa的数据"hello cherry 10.9.9.1 in ok"切割成数组@aa=("hello","cherry"."10.9.9.1"."in"."ok");
这样写不行啊:
#!/usr/bin/perl -w
$aa="hello cherry 10.9.9.1 in ok";
@bb=split/\s/,$aa; 写成@bb=split/ /,$aa; 。。。。。。
以上写法都不行,求答案
报错提示:Use of uninitialized value in concatenation (.) or string at ./bb line 4. 展开
$aa="hello cherry 10.9.9.1 in ok";
如何将$aa的数据"hello cherry 10.9.9.1 in ok"切割成数组@aa=("hello","cherry"."10.9.9.1"."in"."ok");
这样写不行啊:
#!/usr/bin/perl -w
$aa="hello cherry 10.9.9.1 in ok";
@bb=split/\s/,$aa; 写成@bb=split/ /,$aa; 。。。。。。
以上写法都不行,求答案
报错提示:Use of uninitialized value in concatenation (.) or string at ./bb line 4. 展开
2个回答
展开全部
#!/usr/bin/perl -w
$aa="hello cherry 10.9.9.1 in ok";
@bb=split/\s/,$aa;
print join "\n",@bb
完全可以正确输出。
你报的错是第四行,可是你只给了三行代码。所以你给的三行代码是没问题的,错在第四行。
你如果还找不到问题的话,希望你连代码和运行结果一起截图,我看一下。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询