Questions tagged [perl4]

4 questions
85
votes
9 answers

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

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…
Geo
  • 93,257
  • 117
  • 344
  • 520
2
votes
4 answers

Why isn't Perl's tr/// doing what I want?

I am using Perl for a script that takes in input as two short strings of DNA. As an output, I concatenate the two strings strings then print the second string lined up over its copy at the end of the concatenated string. For example: if input string…
shubster
  • 825
  • 4
  • 13
  • 39
2
votes
3 answers

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

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…
shubster
  • 825
  • 4
  • 13
  • 39
1
vote
1 answer

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

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…
bballdave025
  • 1,347
  • 1
  • 15
  • 28