> "PK" == Parag Kalra writes:
PK> use strict;
PK> use warnings;
PK> while(){
PK> my $num = $. - 1;
PK> s/\d+/$num/ if /\w+\s+\d+\s+\w/;
there is no need for the if as you can just do a s/// directly. and it
can do the num part as well.
s/(\w+\s+)\d+(\s+\w+)/$1 . $
use strict;
use warnings;
while(){
my $num = $. - 1;
s/\d+/$num/ if /\w+\s+\d+\s+\w/;
print $_;
}
__DATA__
charith 4 matara
saman 8 kandy
andrew 9 colombo
dilshan 3 galle
shanil 10 jafna
Parag
On Fri, Sep 2, 2011 at 8:42 PM, Charith LokuBogahawatta
wrote:
> Hi All,
>
> I'm new to
Hi all,
On Sat, 03 Sep 2011 17:15:51 -0400
Shawn H Corey wrote:
> On 11-09-03 05:01 PM, Jon Forsyth wrote:
> > Hello,
> >
> > According to the grep manual page I can use the -P option to use Perl
> > regular expressions as follows:
> >
> > grep -P PERL_REGEX INPUT_FILE
> >
> > however, I cannot
Hi Rajeev,
please acknowledge you have received and read this message.
On Sat, 3 Sep 2011 15:47:42 -0700 (PDT)
Rajeev Prasad wrote:
> ...
> ...
>
> $k=1;
> my $arSZ = @tmpAR=split(/"/,$line);
> for $x (0..$arSZ-1){
> if ($x % 2 == 0) {
> push(@modline,"$tmpAR[$x]");
>
> } else
ׁHi Charith,
On Fri, 2 Sep 2011 20:42:31 -0700 (PDT)
Charith LokuBogahawatta wrote:
> Hi All,
>
> I'm new to this group also for perl but nowadays I working around with
> Perl and I need some help. this my first thread please anyone can help
> me?
>
> i have a file contains the following data.
Hi All,
I'm new to this group also for perl but nowadays I working around with
Perl and I need some help. this my first thread please anyone can help
me?
i have a file contains the following data.
charith 4 matara
saman 8 kandy
andrew 9 colombo
dilshan 3 galle
shanil 10 jafna
.
.
.
Here I want
On Sep 2, 4:46 am, ratul...@yahoo.co.in (anirban adhikary) wrote:
> Hi I have write the following code and Now I have been asked to write a unit
> test case for this code. But neither I have any idea how to write a unit
> test case nor I have ever experience with it. So in this case I am asking
...
...
$k=1;
my $arSZ = @tmpAR=split(/"/,$line);
for $x (0..$arSZ-1){
if ($x % 2 == 0) {
push(@modline,"$tmpAR[$x]");
} else {
my $count = $tmpAR[$x-1] =~ tr/,/,/; #try for something more correct
like... =~ m/\,/g);
$k = $k + $count;
push(@modline,"STRING.$k"
> "RD" == Rob Dixon writes:
RD> On 03/09/2011 21:34, Uri Guttman wrote:
>> Ron Weidner wrote:
>>
>> first off, arrays have nothing (or little) to do with OOP. you are using
>> arrays inside an object but the code at that point is just plain perl.
RD> That is a strange assertion
> "JF" == Jon Forsyth writes:
JF> According to the grep manual page I can use the -P option to use
JF> Perl regular expressions as follows:
JF> grep -P PERL_REGEX INPUT_FILE
just to let you know, nothing but perl can run perl regexes. all the
ones that claim it are doing subsets and
On 11-09-03 05:01 PM, Jon Forsyth wrote:
Hello,
According to the grep manual page I can use the -P option to use Perl
regular expressions as follows:
grep -P PERL_REGEX INPUT_FILE
however, I cannot get the following pattern to match a literal dollar sign:
grep -P makan\$ file.txt
# You ha
On 03/09/2011 21:34, Uri Guttman wrote:
Ron Weidner wrote:
first off, arrays have nothing (or little) to do with OOP. you are using
arrays inside an object but the code at that point is just plain perl.
That is a strange assertion. So OO software is more to do with scalars?
Or hashes? I will
Hello,
According to the grep manual page I can use the -P option to use Perl
regular expressions as follows:
grep -P PERL_REGEX INPUT_FILE
however, I cannot get the following pattern to match a literal dollar sign:
grep -P makan\$ file.txt
when I know this pattern is in the file. It matches
On 03/09/2011 20:54, Ron Weidner wrote:
In a module I have code that looks like this...
sub add_widget
{
my $self = shift;
my $new_widget = shift;
push ( @{$self->{WIDGETS}}, $new_widget );
}
sub get_widgets
{
my $self = shift;
return $self->{WIDGETS};
}
I'm writing a
On 11-09-03 03:54 PM, Ron Weidner wrote:
In a module I have code that looks like this...
sub add_widget
{
my $self = shift;
my $new_widget = shift;
push ( @{$self->{WIDGETS}}, $new_widget );
}
sub get_widgets
{
my $self = shift;
return $self->{WIDGETS};
}
I'm writing a
> "RW" == Ron Weidner writes:
first off, arrays have nothing (or little) to do with OOP. you are using
arrays inside an object but the code at that point is just plain perl.
RW> In a module I have code that looks like this...
RW> sub add_widget
RW> {
RW> my $self = shift;
RW>
In a module I have code that looks like this...
sub add_widget
{
my $self = shift;
my $new_widget = shift;
push ( @{$self->{WIDGETS}}, $new_widget );
}
sub get_widgets
{
my $self = shift;
return $self->{WIDGETS};
}
I'm writing a test that is failing at runtime with the follow
comma is 'the' field seperator, if x=, then it is field seperator.
x=alpha OR numeric OR special character
ABC = uppercase alphabets
" = quotes clubs some fields together. so they are always balanced (in a pair).
we also have to find out position number of quote (") character.
From: Rob Dixon
On Sat, 03 Sep 2011 13:39:47 +0200, werner wrote:
> Am 03.09.11 13:31, schrieb Sean Murphy:
>> All.
>>
>> How can I access my IMap messages from Google via Perll. I wish to
>> extract the message body only.
> how about Mail::IMAPClient?
Or Net::IMAP::Client...
--
Peter Scott
http://www.perlmed
On Fri, 02 Sep 2011 14:16:30 +0530, anirban adhikary wrote:
> Hi I have write the following code and Now I have been asked to write a
> unit test case for this code. But neither I have any idea how to write
> a unit test case nor I have ever experience with it. So in this case I
> am asking your
Am 03.09.11 13:31, schrieb Sean Murphy:
> All.
>
> How can I access my IMap messages from Google via Perll. I wish to extract
> the message body only.
>
> Sean
Hi,
how about Mail::IMAPClient?
Werner
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail
On 03/09/2011 12:22, Ron Weidner wrote:
I'm trying to add a object to an array of objects. The code below is
wrong.
sub add_widget
{
my $self = shift;
my $new_widget = shift;
push ( @($self->{WIDGETS}), $new_widget );
}
Hi Ron
You probably want
push @{$self->{WIDGETS}}, $n
All.
How can I access my IMap messages from Google via Perll. I wish to extract the
message body only.
Sean
I'm trying to add a object to an array of objects. The code below is wrong.
sub add_widget
{
my $self = shift;
my $new_widget = shift;
push ( @($self->{WIDGETS}), $new_widget );
}
Later, I'm going to need to iterate over the array of widgets. How can I
accomplish these 2 tasks?
2011/9/2 Emeka :
> http://emekamicro.blogspot.com/2011/09/perl-here-i-come.html
It's cool.
--
\0/ Hobbestigrou
site web: erakis.im
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
On 02/09/2011 23:33, Rajeev Prasad wrote:
friends,
I am now trying to parse this string in this way...
x= could be anything including special character
string = xx:ABC,xx,x,x,x,"x,x,x",x,x,x,"x,x",x
string0=ABC
string2="x,x,x"
string3="x,x"
string1=xx:string0,tt,x,x,x,string2,x,x,x,string3,x
26 matches
Mail list logo