如何从默认标量中提取字符串.

问题描述:

你好,
我在perl中有这个小代码,现在我非常确定该怎么做.我已经从csv文件int0 $ _中读取了一行,现在我需要从中提取字符串的一部分.

CSV文件中的前行将是
一;二;三;四;五;六

我需要有一个变量(标量)才能具有值
fourfive

(在四到五个之间没有分号)
我尝试了模式匹配,但没有得到正确的结果
可以提供任何帮助.

Hello,
I have this small code to do in perl and i am now very sure of how to do it. I have read a line from the csv file int0 $_and now i need to extract a part of the string from it.

Ex line in csv file would be
one;two;three;four;five;six

and i need to have a variable (a scalar) to have the value
fourfive

(without the semicolon between four and five)
i tried with pattern matching but didnt get the proper results
can any one help.

_,现在我需要从中提取字符串的一部分.

CSV文件中的前行将是
一;二;三;四;五;六

我需要有一个变量(标量)才能具有值
fourfive

(在四到五个之间没有分号)
我尝试了模式匹配,但没有得到正确的结果
谁能帮忙.
_and now i need to extract a part of the string from it.

Ex line in csv file would be
one;two;three;four;five;six

and i need to have a variable (a scalar) to have the value
fourfive

(without the semicolon between four and five)
i tried with pattern matching but didnt get the proper results
can any one help.


您需要的是:

What you need is this:


info =一个;两个;三个;四个;五个;六个;" @items = split(/;/,
info = "one;two;three;four;five;six;" @items = split(/;/,