Re: Statement failure inside a loop

2015-06-18 Thread Илья Рассадин
I think, even better if initialize magic numbers and symbols use constant NEWLINE_SYMBOL => chr(10); use constant SOME_MEANINGFULL_NAME => ; чт, 18 июня 2015 г. в 16:54, Shlomi Fish : > Hi Marco, > > see below for my response. > On Thu, 18 Jun 2015 15:17:27 +0200 > Marco wrote: > > > Hello

Re: regex capture question

2015-06-18 Thread Shlomi Fish
Hi Tiago, Please reply to list if it's a mailing list post - http://shlom.in/reply . On Thu, 18 Jun 2015 10:20:57 -0300 Tiago Hori wrote: > Folks, > > I have the following regex: $_ =~ /(Crosses)(.*)(misses=)(\d+)/s > > It does what I need to do in terms of matching, but I also want to use th

Re: Statement failure inside a loop

2015-06-18 Thread Shlomi Fish
Hi Marco, see below for my response. On Thu, 18 Jun 2015 15:17:27 +0200 Marco wrote: > Hello. > > I need some help in understanding why the first > > my ($Count,$Saw)=$self->{_Portobj}->read(1); > > is executed without any problem , however the second identical statement > inside the whil

Re: regex capture question

2015-06-18 Thread Илья Рассадин
Hi, Tiago! I can't reproduce such behaviour use Modern::Perl '2014'; my $string = 'Crosses misses=50 '; my (@matches) = ($string =~ /(Crosses)(.*)(misses=)(\d+)/s); use Data::Dumper; print Dumper \@matches; result: $VAR1 = [ 'Crosses', ' ', 'mis

regex capture question

2015-06-18 Thread Tiago Hori
Folks, I have the following regex: $_ =~ /(Crosses)(.*)(misses=)(\d+)/s It does what I need to do in terms of matching, but I also want to use the capture parenthesis. The data comes from tab-limited files and I use $4 to grab the last digits of the match, however it is also matching the trailing

Statement failure inside a loop

2015-06-18 Thread Marco
Hello. I need some help in understanding why the first my ($Count,$Saw)=$self->{_Portobj}->read(1); is executed without any problem , however the second identical statement inside the while loop fails with the error Can't call method "read" on an undefined value at wt800.pm line 121 Th

Re: want to access single value in a hash

2015-06-18 Thread Balasubramanian Duraisamy
Try this : my @k =keys $cmd_param_show; print "$k[0]\n"; On Thu, Jun 18, 2015 at 3:04 PM, Andrew Solomon wrote: > I'm having trouble understanding your question Sunita. Maybe if you say: > > == > I want to write a subroutine "helpme" which takes two arguments > a hashref and a string. Calling >

Re: want to access single value in a hash

2015-06-18 Thread Andrew Solomon
I'm having trouble understanding your question Sunita. Maybe if you say: == I want to write a subroutine "helpme" which takes two arguments a hashref and a string. Calling helpme($cmd_param_show, $some_string) would return $some_other_string == and explain what $some_string and $some_other_stri

RE: want to access single value in a hash

2015-06-18 Thread Sunita Pradhan
Yeah I am able to access the value but how to get the key ? -Sunita From: akshaymohit2...@gmail.com Date: Thu, 18 Jun 2015 14:46:10 +0530 Subject: Re: want to access single value in a hash To: sunita.pradhan.2...@hotmail.com CC: beginners@perl.org Try this:-print "$cmd_param_show->{'scsitrace_sta

Re: want to access single value in a hash

2015-06-18 Thread Akshay Mohit
Try this:- print "$cmd_param_show->{'scsitrace_start_log_to_disk_true'}->{'param_val'}->{'log-to-disk'}\n"; -Akshay On Thu, Jun 18, 2015 at 2:35 PM, Sunita Pradhan < sunita.pradhan.2...@hotmail.com> wrote: > I have following data structure : > > my $cmd_param_show = {'scsitrace_start_log_to_disk

want to access single value in a hash

2015-06-18 Thread Sunita Pradhan
I have following data structure : my $cmd_param_show = {'scsitrace_start_log_to_disk_true' => {'param_val'=>{'log-to-disk' => 'true'}, 'scsitrace_show' => {'log-to-disk'=> 'true', 'enabled'=>