uniq array creation

2015-11-24 Thread Sunita Pradhan
Hi I want to create a unique array . I have the code below. It is creating a array which will have duplicate data . How can I filter duplicate data ? #!/usr/bin/perl use Data::Dumper; #my $cnt = scalar @$net_int_parsed_output; $net_int_parsed_output = [lif_1

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'=

RE: want to access single value in a hash

2015-06-18 Thread Sunita Pradhan
-{'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_true' = {'param_val'={'log-to-disk

perl function for byte to MB conversion

2015-05-25 Thread Sunita Pradhan
Hi Is there any perl module for byte , KB, MB conversion ? ThanksSunita

RE: perl function for byte to MB conversion

2015-05-25 Thread Sunita Pradhan
can find suitable solutions at CPAN. For example, https://metacpan.org/pod/Format::Human::Bytes This module seems to be exactly what you looking for. пн, 25 мая 2015 г. в 15:37, Sunita Pradhan sunita.pradhan.2...@hotmail.com: Hi Is there any perl module for byte , KB, MB conversion

last statement in a package

2015-05-21 Thread Sunita Pradhan
Hi Why a perl programmer use 1 or any number as last statement in module or package (like : 1;)?I checked without that also package gets loaded . Can somebody please explain properly , it would be good with examples ? ThanksSunita

perl certification

2015-05-20 Thread Sunita Pradhan
HiDo you know any sites which helps to take up perl certifications course and exams? ThanksSunita

RE: Creating a hash of arrays from DATA

2014-07-10 Thread Sunita Pradhan
You can try using a reference instead of hash like : -- my $entries; my($state, $zipcodes); while (my $line = DATA) { chomp $line; ($state, $zipcodes) = split (/=/, $line); push( @{ $entries-{$state} }, split( /,/,$zipcodes) ) } print Dumper ($entries); __DATA__

script to match a valid email id

2014-07-10 Thread Sunita Pradhan
I want to write a script which will verify a valid email address . Could anybody give some ideas , how to write a pattern for this ? -Sunita

RE: script to match a valid email id

2014-07-10 Thread Sunita Pradhan
I do not want to use Cpan modules . -Sunita Date: Thu, 10 Jul 2014 11:33:24 -0700 Subject: Re: script to match a valid email id From: r...@i.frys.com To: sunita.pradhan.2...@hotmail.com CC: beginners@perl.org Sunita Pradhan wrote: I want to write a script which will verify a valid

want to write to file in different format

2014-07-07 Thread Sunita Pradhan
I have a file of contents: --- 1 6 2 7 3 8 4 9 5 10 -- I want a file with content: 1 2 3 4 5 6 7 8 9 10 I have written a few lines of following code but it does not work as expected : --- #!/usr/bin/perl use v5.10; use strict;

RE: want to write to file in different format

2014-07-07 Thread Sunita Pradhan
Design Systems (I) Pvt. Ltd. Mob:- +91-8527749333 On 7 July 2014 15:26, John Delacour johndelac...@gmail.com wrote: On 7 Jul 2014, at 09:18, Sunita Pradhan sunita.pradhan.2...@hotmail.com wrote: I have a file of contents: --- 1 6 2 7 3 8 4 9 5 10 -- I want

loop does select next line

2014-07-05 Thread Sunita Pradhan
I have a set of code for count number of lines and number of words . #!/usr/bin/perl while ($line = STDIN){ chomp ($line); $hash{L_c_start}++ if ($line =~ /^C.*/i); @words = split /\s+/,$line; foreach $c (keys @words){ print word $words[$c]\n;

one line script for word count

2014-06-30 Thread Sunita Pradhan
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

printing hash having undefined key

2014-06-23 Thread Sunita Pradhan
Here is my code where i want to print one hash with one key undefined . I have condition print if key exist . I guess it should not print value for undefined key , but it does . #!/usr/bin/perl -w @array = (abc, 123, dfg ,456, xsd,undef); %hash = reverse @array; foreach $k (keys %hash){

RE: Need to Grep only fail count from the Pattern.

2014-06-23 Thread Sunita Pradhan
Can you explain little bit , how this regex will work ? -Sunita Date: Mon, 23 Jun 2014 17:12:17 +0530 Subject: Re: Need to Grep only fail count from the Pattern. From: shajiin...@gmail.com To: vernekaru...@gmail.com CC: beginners@perl.org Hi Uday, Here's one way to do it. [code]use strict;use

uninitialized error for hash printing

2014-06-22 Thread Sunita Pradhan
I have following code for printing a simple hash. #!/usr/bin/perl -w %hash = (abc = 123, dfg = 456, xsd = 34); foreach $k (keys %hash){ print key $k:: value $hash{$k}\n; } It does not print keys and displays following warnings: -- Use of uninitialized value $k:: in