相关疑难解决方法(0)

如何删除Perl字符串中的空格?

如果我$myString用值声明了一个变量'3 '(注意空格).是否有任何函数可以删除返回值的空白区域.有点像SomeFun($myString) 回归'3'(没有白色空间).

#!C:\Perl\bin\perl.exe
use strict;
use warnings;
use Data::Dumper; 

my $fh = \*DATA; 

print Dumper parse_constant_spec( $fh ); 


# Parse a constant spec file. 
# Pass in a handle to process. 
# As long as it acts like a file handle, it will work. 
sub parse_constant_spec { 
    my $fh = shift; 

    my %spec; 

    # Until file is done: 
        # Read in a whole block 
    while( my $block = read_block($fh) ) { 

        # …
Run Code Online (Sandbox Code Playgroud)

perl

13
推荐指数
5
解决办法
9万
查看次数

标签 统计

perl ×1