perl4

How do I chomp a string if I have Perl 4?

早过忘川 提交于 2019-12-24 01:55:11
问题 I am writing a script on my personal machine which is connected to the remote server. I think the remote server has Perl 4.0 or lesser version installed and that is why it is unable to recognize the same. Is there an alternative to the chomp command? 回答1: It's not an exact replacement, but you could try: $var =~ s/\r?\n?$// which will strip either CRLF (DOS), LF (Unix), CR (Mac?). The normal chomp operator always strips out the currently defined $INPUT_RECORD_SEPARATOR for the current O/S.

How do I chomp a string if I have Perl 4?

扶醉桌前 提交于 2019-12-24 01:55:02
问题 I am writing a script on my personal machine which is connected to the remote server. I think the remote server has Perl 4.0 or lesser version installed and that is why it is unable to recognize the same. Is there an alternative to the chomp command? 回答1: It's not an exact replacement, but you could try: $var =~ s/\r?\n?$// which will strip either CRLF (DOS), LF (Unix), CR (Mac?). The normal chomp operator always strips out the currently defined $INPUT_RECORD_SEPARATOR for the current O/S.

sclite (SCTK) `make check` faliure, C++/perl/Cygwin, Safe to use Perl4 stuff?

痴心易碎 提交于 2019-11-29 12:43:29
I am currently trying to install NIST's sclite , which is part of SCTK 2.4.0 ( github or newer version ). I am attempting the install on Cygwin in bash . The installation is done using make . I have gotten past the make configure and make all parts of the installation. This didn't come without some effort (See the SO posts on the first ( file not recognized ) and second (template/scoping) problems). When I get to the make check part of the install, a lot of the checks/tests pass, but then I get the following error. Testing acomp.pl No tests defined for acomp.pl make[2]: Leaving directory '

sclite (SCTK) `make check` faliure, C++/perl/Cygwin, Safe to use Perl4 stuff?

半世苍凉 提交于 2019-11-28 06:23:41
问题 I am currently trying to install NIST's sclite , which is part of SCTK 2.4.0 (github or newer version). I am attempting the install on Cygwin in bash . The installation is done using make . I have gotten past the make configure and make all parts of the installation. This didn't come without some effort (See the SO posts on the first ( file not recognized ) and second (template/scoping) problems). When I get to the make check part of the install, a lot of the checks/tests pass, but then I get

Is there a Perl shortcut to count the number of matches in a string?

梦想与她 提交于 2019-11-27 06:43:06
Suppose I have: my $string = "one.two.three.four"; How should I play with context to get the number of times the pattern found a match (3)? Can this be done using a one-liner? I tried this: my ($number) = scalar($string=~/\./gi); I thought that by putting parentheses around $number , I'd force array context, and by the use of scalar , I'd get the count. However, all I get is 1 . That puts the regex itself in scalar context, which isn't what you want. Instead, put the regex in list context (to get the number of matches) and put that into scalar context. my $number = () = $string =~ /\./gi; I

Is there a Perl shortcut to count the number of matches in a string?

梦想与她 提交于 2019-11-26 12:08:04
问题 Suppose I have: my $string = \"one.two.three.four\"; How should I play with context to get the number of times the pattern found a match (3)? Can this be done using a one-liner? I tried this: my ($number) = scalar($string=~/\\./gi); I thought that by putting parentheses around $number , I\'d force array context, and by the use of scalar , I\'d get the count. However, all I get is 1 . 回答1: That puts the regex itself in scalar context, which isn't what you want. Instead, put the regex in list