please Explain
next if $line =~ /^-/;
my @f = split('\s*\|\s*',$line);
next unless scalar @f == 8;
On Fri, Jun 27, 2014 at 6:44 PM, Uday Vernekar vernekaru...@gmail.com
wrote:
Thanks to allcheers
On Thu, Jun 26, 2014 at 10:28 PM, Jim Gibson jimsgib...@gmail.com wrote:
On
On Jun 30, 2014, at 2:44 AM, Uday Vernekar vernekaru...@gmail.com wrote:
please Explain
next if $line =~ /^-/;
“Skip this input line if it starts with a dash ‘-‘ character.”
my @f = split('\s*\|\s*',$line);
Break the input line into files separated by the vertical pipe character ‘|’
Hi
I want to count number of occurrences of one word in a line within one single
line of perl script .
My code :
$c++ if ($line =~ /\s+$w\s+/g);
print count $c\n;
It always return one even if $line contains same word twice . It does not do
the global match.
It works if I split the line but
On Jun 30, 2014, at 11:57 AM, Sunita Pradhan wrote:
Hi
I want to count number of occurrences of one word in a line within one single
line of perl script .
My code :
$c++ if ($line =~ /\s+$w\s+/g);
print count $c\n;
Try this:
$c = () = $line =~ /\b$w\b/g;
--
To unsubscribe,
On Mon, Jun 30, 2014 at 11:57 AM, Sunita Pradhan
sunita.pradhan.2...@hotmail.com wrote:
Hi
I want to count number of occurrences of one word in a line within one
single line of perl script .
My code :
$c++ if ($line =~ /\s+$w\s+/g);
print count $c\n;
It always return one even if $line
On Mon, Jun 30, 2014 at 1:41 PM, Charles DeRykus dery...@gmail.com wrote:
On Mon, Jun 30, 2014 at 11:57 AM, Sunita Pradhan
sunita.pradhan.2...@hotmail.com wrote:
Hi
I want to count number of occurrences of one word in a line within one
single line of perl script .
My code :
$c++ if
On Mon, Jun 30, 2014 at 1:53 PM, Charles DeRykus dery...@gmail.com wrote:
On Mon, Jun 30, 2014 at 1:41 PM, Charles DeRykus dery...@gmail.com wrote:
On Mon, Jun 30, 2014 at 11:57 AM, Sunita Pradhan
sunita.pradhan.2...@hotmail.com wrote:
You could alter context, ie, change if to while,
On Jun 30, 2014, at 12:17 PM, Sunita Pradhan wrote:
Thanks Jim. It is working but why a array is required here?
Please respond to the list and not to me personally. That way, everybody will
see your question, and somebody else can answer.
Try this:
$c = () = $line =~ /\b$w\b/g;
On 30 Jun 2014, at 20:05, Jim Gibson jimsgib...@gmail.com wrote:
Try this:
$c = () = $line =~ /\b$w\b/g;
Or, slightly less obscure:
#!/usr/bin/perl
use strict;
my $line = one potato two potato three potato four;
my @hits = $line =~ /potato/g;
print scalar @hits; # = 3
#JD
--
To