Perl special variable “@_” in a subroutine not working

半腔热情 提交于 2019-12-02 08:16:51

It's

my ($csv_html_line) = @_ ;

The way you wrote the code you evaluated @_ in scalar context and got its length (number of elements). As you noted,

my $csv_html_line = shift;

works because the shift operator takes a list and removes and returns the first element as a scalar.

You need

my ($csv_html_line) = @_ ;

as assigning an array to a scalar will return its length (which is 1 with one parameter)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!