compare and replace each line with Hash

2012-11-15 Thread Mohan L
'name' => 'Done', 'id' => '1' }, '2' => { 'name' => 'Not', 'id' => '2'

Re: How to do ssh connection from client-to-remote machine1-to-remote machine2-to-remote machine3 and execute command on remote machine3

2012-08-24 Thread Mohan L
at, using this we can connect only to client -to- remote machine-1. > > Any thoughts/example code to handle this scenario. > > > Thanking you, > -- > Sasikanth > Hi Sasikanth, Have you tried Expect perl Expect module ( http://search.cpan.org/~rgiersig/Expect-1.15/) ? Thanks Mohan L

Re: Recommended config/ini file module?

2012-05-01 Thread Mohan L
ql_driver = $database{mysql_driver}; my $mysql_database = $database{mysql_database}; my $mysql_username = $database{mysql_username}; my $mysql_password = $database{mysql_password}; my $mysql_socket = $database{mysql_socket}; Thanks Mohan L

Re: split

2012-04-05 Thread mohan . p
in that line 4) go to second line Cheers, Mohan From: Anamika K To: beginners@perl.org Date: 04/04/2012 06:28 PM Subject:split Hello All, I have a file like this: NM_009648,NM_001042541:10.955794504181601 NM_019584:1 0.900900900900901 NM_198862:1

Re: Manipulating reference to array of array references

2011-11-21 Thread Mohan L
entioned was I wanted. Thanks for all your guidance. Thanks & Rg Mohan L

Manipulating reference to array of array references

2011-11-19 Thread Mohan L
;marge", "maggie", ], [ "george", "jane",undef, "elroy",undef,"judy", ], ]; print Dumper $ref_to_AoA; print $ref_to_AoA->[0]->[0]; [mohan@localhost ~]$ ./dymmy.pl $VAR1 = [ [ 'fred',

Re: perl code to export data to excel

2011-08-04 Thread Mohan L
now very basis of perl, then you can use the example code in the above link. Thanks & Rg Mohan L

Re: help to print a hash with hash

2011-07-20 Thread Mohan L
'north,0,0,7,3,0,0,0,10', 'south,3,0,1,3,0,0,0,7', 'west,7,0,0,0,0,0,0,7' ]; It trying to store that string into the first column and nothing into the subsequent columns. That is why it shows "column cannot be null" error messages. Thanks Jim Gibson!!!. Jim Gibson, I understand the problem, but I not sure where in the below code I am making mistake . my @dbdata=(); for my $region ( sort keys %region_data ) { my @mydata; my $d = $region_data{ $region }; @mydata= join( ",", $region,map( $d->{ status }{ $_ }{ count }, @statuses_string ),$d->{ total_count },); push(@dbdata,@mydata); } Thanks & Rg Mohan L

Re: help to print a hash with hash

2011-07-20 Thread Mohan L
On Wed, Jul 20, 2011 at 9:23 PM, shawn wilson wrote: > On Wed, Jul 20, 2011 at 10:41, Mohan L wrote: > > > > > DBD::mysql::st execute failed: Column 'open' cannot be null at > > ./demo.plline 104, line 30. > > DBD::mysql::st execute failed: Column '

Re: help to print a hash with hash

2011-07-20 Thread Mohan L
How to insert below data structure in data base? #!/usr/bin/perl > >> use strict; >> use warnings; >> >> my %data = ( >> >> south => { >> status => { >> open => { count => 3 }, >> pws => { count => 3 }, >> wip => { count => 0 }, >> hold => { count => 1 }, >> 're-open' => { count => 0 }

Re: help to print a hash with hash

2011-07-14 Thread Mohan L
#x27;0',' 0',' 10'], ["south", '3',' 3' ,'0' ,'1', '0',' 0' ,'0', '7' ], ) my $connect = DBI->connect($dsn, $username, $password); my $query = "INSERT INTO by_region (region,open,pws,wip ,hold,reopen,pwu,openesc,total) VALUES (?,?,?,?,?,?,?,?,?)"; my $query_handle = $connect->prepare($query); for my $datum (@dbdata) { $query_handle->execute(@$datum); } How to make the above (%data) hash into below reference : @dbdata=( ["north" ,'3', '0' ,'0', '7' ,'0' ,'0',' 0',' 10'], ["south", '3',' 3' ,'0' ,'1', '0',' 0' ,'0', '7' ], ) It will solve my problem. I hope this time I am clear. Thanks & Rg Mohan L

help to print a hash with hash

2011-07-14 Thread Mohan L
10 using below query: my $query = "INSERT INTO by_region (region,open,pws,wip,hold,re-open,pwu,openesc,total_count) VALUES (?,?,?,?,?,?,?,?,?)"; I am trying some thing like to print : foreach my $line (keys %region_data) { print "$line\n"; foreach my $item (keys %{$region_data {$line}}) { print "$item\n"; } } Output : south status total_count north status total_count west status total_count east status total_count But I don't know how to print next level. I need someone help to point right direction. Thanks & Rg Mohan L

Re: summarise input data using Perl

2011-07-14 Thread Mohan L
x error at ./demo.pl line 29, near "File > > Hi Leo, Sorry . The below line works fine. It is {count}++ $region_data{ lc($columns[3]) }{status}{ lc($columns[0]) } { count}++; $region_data{ lc($columns[3]) }{total_count}++; Thanks for you time !!!. Thanks & Rg Mohan L

Re: summarise input data using Perl

2011-07-14 Thread Mohan L
On Wed, Jul 13, 2011 at 11:30 PM, Leo Susanto wrote: > Mohan, > > I would suggest you learning perl hash: http://perl101.org/hashes.html > Yes. I will learn the perl hash. > > #!/usr/bin/perl > use Text::CSV; > use DBI; > use Data::Dumper; > > # CONFIG VAR

summarise input data using Perl

2011-07-13 Thread Mohan L
WestCount; my $region_id=1; my @data = ( ['0',$region_id,$EastCount[0],$EastCount[1],$EastCount[2],$EastCount[3],$EastCount[4],$Region_Total[0]], ['1',$region_id,$NorthCount[0],$NorthCount[1],$NorthCount[2],$NorthCount[3],$NorthCount[4],$Region_Total[1]], ['2',$region_id,$SouthCount[0],$SouthCount[1],$SouthCount[2],$SouthCount[3],$SouthCount[4],$Region_Total[2]], ['3',$region_id,$WestCount[0],$WestCount[1],$WestCount[2],$WestCount[3],$WestCount[4],$Region_Total[3]], ); ## PERL DBI CONNECT my $connect = DBI->connect($dsn, $username, $password); ### PREPARE THE QUERY my $query = "INSERT INTO by_region (reg_id,region_id,pws,open,hold,pwu,re_open,total) VALUES (?,?,?,?,?,?,?,?)"; my $query_handle = $connect->prepare($query); ### EXECUTE THE QUERY for my $datum (@data) { $query_handle->execute(@$datum); } } # Over All Pending data File my $oapdata='sample.csv'; my $csv=Text::CSV->new({ sep_char => "\t" }); open(CSV,"<",$oapdata) or die $!; while () { if ($csv->parse($_)) { my @columns = $csv->fields(); ByRegion(@columns); } else { my $err = $csv->error_input; print "Failed to parse line: $err"; } } InsertByRegion; print "The END!!!\n"; close CSV; Thanks for your time. - Mohan L

summarise input data using Perl

2011-07-13 Thread Mohan L
WestCount; my $region_id=1; my @data = ( ['0',$region_id,$EastCount[0],$EastCount[1],$EastCount[2],$EastCount[3],$EastCount[4],$Region_Total[0]], ['1',$region_id,$NorthCount[0],$NorthCount[1],$NorthCount[2],$NorthCount[3],$NorthCount[4],$Region_Total[1]], ['2',$region_id,$SouthCount[0],$SouthCount[1],$SouthCount[2],$SouthCount[3],$SouthCount[4],$Region_Total[2]], ['3',$region_id,$WestCount[0],$WestCount[1],$WestCount[2],$WestCount[3],$WestCount[4],$Region_Total[3]], ); ## PERL DBI CONNECT my $connect = DBI->connect($dsn, $username, $password); ### PREPARE THE QUERY my $query = "INSERT INTO by_region (reg_id,region_id,pws,open,hold,pwu,re_open,total) VALUES (?,?,?,?,?,?,?,?)"; my $query_handle = $connect->prepare($query); ### EXECUTE THE QUERY for my $datum (@data) { $query_handle->execute(@$datum); } } # Over All Pending data File my $oapdata='sample.csv'; my $csv=Text::CSV->new({ sep_char => "\t" }); open(CSV,"<",$oapdata) or die $!; while () { if ($csv->parse($_)) { my @columns = $csv->fields(); ByRegion(@columns); } else { my $err = $csv->error_input; print "Failed to parse line: $err"; } } InsertByRegion; print "The END!!!\n"; close CSV; Thanks for your time. - Mohan L

Re: Need help with writing recursive menu in Perl.

2010-05-18 Thread Mohan
Hi There is an example available in the following location http://squirrelmail.svn.sourceforge.net/viewvc/squirrelmail/trunk/squirrelmail/config/conf.pl?view=markup its a recursive menu driven script. HTH. -- Regards, Mohan. On 18/05/10 13:40, Steve Bertrand wrote: On 2010.05.17 21:44

Re: help in perl script

2010-05-18 Thread Mohan
t perldoc -f system -- Regards, Mohan On 18/05/10 15:48, Shawn H Corey wrote: On 10-05-18 10:27 AM, Chaitanya Yanamadala wrote: ok is it so.. thank you so i think i can do one thing like open the file ~/.bash_history and then read the file.. actually i am trying this alternative.. but there is some

append to an Excel File

2005-12-13 Thread vinay mohan
HOW CAN I APPEND DATA TO AN EXISTING EXCEL FILE OR MODIFY THE DATA PRESENT IN THE EXCEL FILE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Reading Multiple lines

2002-02-12 Thread J. Raj Mohan
> In article <057501c1b305$6a15b360$[EMAIL PROTECTED]> wrote "J. Raj Mohan" > <[EMAIL PROTECTED]>: > > > Hi Andrea, > > > > Thanks for responding my mail. > > > > Actually I want to read(store it into a string) like; Begin keyword is " > keywo

Reading Multiple lies

2002-02-10 Thread Raj Mohan
Hi All, Is that anybody can help me to find a solution for the blow:- I have a file like this:- Input File:- In this I need to read (store into a string) multiple lines from: "" Pls. help me out. Raj.

perl+MySql+form

2002-01-31 Thread katta ananta mohan
Dear all, I need to know how to link a MySqldatabase on to a web interface like a HTML-form with perl programming .basically I need to retrieve data from the database onto the webinterface by using search methods.I'd appreciate if U provide me with some useful links regarding the same

RE: setting and importing ENV from within PERL

2001-07-26 Thread Venkat Mohan
$ENV{MY_VAR} = "test"; will set the env var MY_VAR -Venkat -Original Message- From: perl newbie [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 26, 2001 3:22 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: setting and importing ENV from within PERL I am trying to figure

RE: if in a list

2001-07-26 Thread Venkat Mohan
One thing When you compare strings use "eq" string comparition operator. Not "=" -Venkat -Original Message- From: Jennifer Pan [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 26, 2001 11:55 AM To: [EMAIL PROTECTED] Subject: if in a list I want to test if "AF1" is in my list @myli

RE: appending to file?

2001-07-26 Thread Venkat Mohan
You can use signal handlers $::SIG{__DIE__} = \&cgi_die; This will be invoke cgi_die sub when ever the script dies You can also look at perldoc sigtrap Same signal names used in unix signal used here. I suggest to look at sigtrap perldoc - Venkat -Original Message- From: David Fr

RE: appending to file?

2001-07-26 Thread Venkat Mohan
EMAIL PROTECTED]] Sent: Thursday, July 26, 2001 4:38 AM To: Venkat Mohan Cc: 'David Freeman'; [EMAIL PROTECTED] Subject: Re: appending to file? Lightning flashed, thunder crashed and Venkat Mohan <[EMAIL PROTECTED]> wh ispered: | --_=_NextPart_001_01C1155C.C049A170 | Con

RE: appending to file?

2001-07-25 Thread Venkat Mohan
Are you closing the APPEND file at the end of the process? -Original Message- From: David Freeman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 25, 2001 3:51 PM To: [EMAIL PROTECTED] Subject: appending to file? ok last question on this script for today. According to the book i sho

RE: fetchrow_array problem with DBI

2001-07-25 Thread Venkat Mohan
Simple, After you prepare the sql statement you must execute the statement. See the non indented line of code below. my $dbh=DBI->connect($db, ,$username,$password) or die "Couldn't connect".DBI->errstr; my $sth=$dbh->prepare('SELECT * FROM tbl_clients')

RE: foreach question

2001-07-24 Thread Venkat Mohan
There are some functions that can return arrays and users can write subs that return arrays. Take this example. my $($string, $token); $string = "Tom is not confused any more"; foreach $token (split ' ', $string) { print "$token\n"; } This will return Tom is not confused any more In the

RE: output of a command to a file

2001-07-24 Thread Venkat Mohan
This will work. open outfile ">>outfile.txt"; open cmdoutput " $command |"; while() { print outfile; } close cmdoutput; close outfile -Original Message- From: Tyler Longren [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 24, 2001 12:48 PM To: Perl Beginners Subject: output of a comman

RE: date help

2001-07-24 Thread Venkat Mohan
This page might help in future. http://www.cpan.org/modules/INSTALL.html If you are using perl in Windows environment try active perl www.activestate.com They have an excellent PPM program which helps a lot. Thanks, Venkat -Original Message- From: Sascha Kersken [mailto:[EMAIL PROTECT

perl ping script using cgi

2001-06-01 Thread Mohan Kompella
Hello all, I was trying to write a cgi-script that displays the results of a ping against a host that is passed to the cgi-script. The first time, I used what I might term the "brute force approach", which didn't work and then, I used Net::Ping, which worked. However I am really curious as to why