Re: What is the difference between () and [] syntax for array?

2013-01-07 Thread Parag Kalra
On Mon, Jan 7, 2013 at 5:33 PM, Neo Anderson wrote: > > my @a1 = (1, 2, 3); > Here we are actually storing the elements into the array. > my @a2 = [1, 2, 3]; > And in this case we are storing the reference to the array containing elements 1, 2 and 3. This should actually be: my $a2 = [1, 2,

How to send RPCs to a Network server using Perl

2012-09-05 Thread Parag Kalra
I am planning to design a simple client application to execute RPC (Remote Procedure Call) on a remote server. All I have managed to learn so far is to create a TCP socket using IO::Socket::INET. But I am not sure what to do next. Any pointers/help/online resources about the same would be helpfu

Question on the function - hex

2012-04-12 Thread Parag Kalra
Why does the output of perl -e "print hex '0x160402'" differs from the output of perl -e "print hex 0x160402" EG: bash-3.2$ perl -e "print hex '0x160402'" 94489281538 $ perl -e "print hex 0x160402" 10189963531576

Re: Introduction and Perl 5 References

2012-02-27 Thread Parag Kalra
On Mon, Feb 27, 2012 at 5:02 PM, Mike wrote: > Hello everyone. Hi > I just wanted to introduce myself to the list. Been following for a little > while, first time posting. My name is Mike Dunaway and I am 25 years old. I > was curious if there were any other members in the 804 area? Do you

Re: Perl Module to parse any other Perl script/module to fetch stats about data-structures

2012-02-08 Thread Parag Kalra
By data-structures being used, I mean the data structures that are actually *declared* in the script. And is it possible to find at least the data-structures stats of the current script that is getting executed if no parser is available. For example if I have a big script or module and if I want

Perl Module to parse any other Perl script/module to fetch stats about data-structures

2012-02-08 Thread Parag Kalra
Do we have any Perl module which can parse any other perl script (or module) and fetch information like total number of arrays being used, total number of hashes, total number of scalar variables etc and size information (like total elements, total keys etc) for each data structure in that perl sc

Re: syntax error near unexpected token `;'

2012-02-06 Thread Parag Kalra
On Mon, Feb 6, 2012 at 8:35 PM, lina wrote: > until ($name eq ""); > do { >print "Enter another name, or Enter to stop:\n" ; >$name = ; >chomp ($name); >push @namelist,$name; > > } > > print @namelist > This should work. Also start using strict and warnings pragma

Re: Foreach loop and hash of arrays

2012-02-06 Thread Parag Kalra
On Mon, Feb 6, 2012 at 1:14 PM, wrote: >For example, do I really need three foreach loops? > > > You can get rid of third ForLoop for sure. use strict; use warnings; my %states = ( AL => [ '350','351', ], AK => [ '995','996', ], AZ => [ '850','851', ], AR => [ '

Inserting a new data structure in a bless reference

2012-01-13 Thread Parag Kalra
The simplest way I thought of expressing this question is through Pseudo-script so here it is: use strict; use warnings; use FooBar; my $obj = FooBar->new; Do something ... $obj->{'new_key'} = 'some_value' Now I am not sure if that is the correct way of inserting a new data struct

Customizing vi/vim for Perl

2011-11-18 Thread Parag Kalra
Hi, I generally use vi/vim for my day to day Perl scripts. What are different packages I can use to make vi/vim extensively customized for Perl. For example - it should be able inform me about the known syntax errors like - variables not declared, missing braces or semicolons etc something whic

Perl variable indirection

2011-11-05 Thread Parag Kalra
Hi, I have a function which looks something like: sub foo_bar { ${$_[0]} = new foo_bar ( address => $_[1], sudo=> $_[3]', id => $_[0] . '_' . $_[2], ); sleep 8;

Re: Inviting ideas for Personal database

2011-10-05 Thread Parag Kalra
> > > > Finally, I should note that you shouldn't prefix your replies with "PK>" or > > Agreed. My mistake. Thanks for bringing it to my notice. BTW I have started using sqllite and I am really enjoying it. Thanks to all. Parag

Re: Inviting ideas for Personal database

2011-10-04 Thread Parag Kalra
On Tue, Oct 4, 2011 at 3:38 PM, Brandon McCaig wrote: > On Tue, Oct 4, 2011 at 5:41 PM, Shawn H Corey > wrote: > > If the database is small, I would consider using SQLite. It stores the > > entire database in a single file which makes it easy to backup and > transfer. > > Thunderbird and Firefox

Inviting ideas for Personal database

2011-10-04 Thread Parag Kalra
I am planning to write a small, non-bulky, easy to use and easy to port application for my personal use. There is lot of information I store on Google docs like commands, key words, directory locations, script names etc. Pretty much everything which I use daily. Switching from shell to Web-browse

Can't use string ("1") as a HASH ref while "strict refs"

2011-09-19 Thread Parag Kalra
Hi, I was getting this error message for one of my script. The reason came out out to be, I had not place a semi-colon at the end of try-catch block. try { something } catch some_exception { do something } After I placed the semi-colon, I am no longer getting this error (Can't use string (

Good resources on CGI programming with Perl

2011-09-08 Thread Parag Kalra
Hi, Could some please suggest any good online resources on learning CGI programming with Perl Also please let me know the goods for the same. Thanks, Parag -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: please Perl help...

2011-09-03 Thread Parag Kalra
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

Re: how to do this in perl (from unix)

2011-09-01 Thread Parag Kalra
Please give a better problem statement like what is the form of data initially present in the file and what you wish to extract. You should also post sample file data for both the files (before and after) Not all people who know Perl might know Unix commands (rare but possible) and so they may no

Re: CPAN on Windows Box

2011-08-23 Thread Parag Kalra
Try this: cpan>install Tk Parag On Tue, Aug 23, 2011 at 3:04 PM, Emeka wrote: > Hello All > I tried this in order to install Perl-tk cpan>install tk... But it > failed to work. > > Emeka > -- > *Satajanus Nig. Ltd > > > * >

Timeout for user input

2011-06-17 Thread Parag Kalra
Hi, I have a requirement where I want to wait for user to input the data. However if user doesn't input the data within certain period of time then it should timeout and move ahead. TIA ~Parag

Efficient way to compare 2 data structures particularly hash

2011-04-30 Thread Parag Kalra
Hi, I am evaluating different approaches to compare data structures in Perl - i.e whether they are same or not. I am planning to start wit: 1. Data::Compare 2. And then found this - http://stackoverflow.com/questions/1273616/how-do-i-compare-two-hashes-in-perl-without-using-datacompare Any oth

Dynamic replacement of the variable

2011-04-17 Thread Parag Kalra
Hi, I am not sure if this can be done. But just asking it out of curiosity. I have written this snippet. use strict; use warnings; my $var = '$str abc_xyz'; my $str; for(my $i=1;$i <= 5; $i++){ $str = $i; my $line = 'Line: '.$var; print "$line\n"; } Currently it displays: Line: $s

Auto-numbering in perlpod

2011-04-16 Thread Parag Kalra
Hi, While creating POD for modules in Perl, I often specify numbered list 1. Parameter1 2. Parameter2 3. Parameter3 .. ... etc or 1. It does this 2. It also does that 3. But it won't do this ... .. etc Currently the numbered list is hard-coded (i.e numbers 1, 2, 3 etc). Can I make it auto-incr

Locking NFS files using File::NFSLock

2011-04-11 Thread Parag Kalra
Hi, I was just exploring File::NFSLock to lock files on the NFS server but seems like its not working. It ends up creating stale files and only option left is to abort the script. I am testing it on NFSv3 Anybody had any success in using this module? Here is my sample code. use strict; use warn

Perl packet tracking module

2011-03-23 Thread Parag Kalra
Hi, Does Perl have any packet tracking module equivalent to tcpdump, snoop, tshark or tethereal TIA ~Parag

Re: MRF-ERROR: Is a directory

2011-03-16 Thread Parag Kalra
On Wed, Mar 16, 2011 at 11:44 AM, wrote: > how to overcome this error : > > MRF-ERROR: Is a directory > > > Please post the entire code. ~Parag

Re: Printing Bash and Kernel Version numbers using Perl

2011-03-12 Thread Parag Kalra
perl -MConfig -e 'print "$Config{perlpath}:$^V\n$ENV{SHELL}:" . qx{ bash > --version | head -1 } . "/kernel/$^O:" . qx{ uname -r }' > Vern Nice. Completely impressed. But I thought Perl might have some internal variable at least for Kernel version. But anyways this work for me too. ~Parag

Printing Bash and Kernel Version numbers using Perl

2011-03-12 Thread Parag Kalra
Hi, Wanted to have suggestions to modify below 1 liner so that it can also print Shell (preferably Bash) version and along with Operating System Kernel version. Currently I am just printing the place holders for Shell and Kernel version numbers. perl -MConfig -le 'print "$Config{perlpath}:$^V\n$

Re: help with array elements

2011-03-12 Thread Parag Kalra
> > > could some one throw some light on how i can do this. > thanks in advance.. > use strict; use warnings; my @array = (1,2,3,4,2,3,1,2,1,1,1,4,6,7); my %hash; foreach my $item (@array){ if (exists $hash{$item}) { $hash{$item} = $hash{$item} + 1; } else { $hash{$item} =

How does the function loading works in Perl

2011-03-02 Thread Parag Kalra
Hi, I have this basic question from a long time now, so thought of asking. A Perl script may have many functions. When we execute the script via Perl Interpreter, does all the functions are loaded into memory? Sometimes we just like to keep the coded functions in the script with the idea that we

Re: Testing File Contents

2011-03-02 Thread Parag Kalra
On Wed, Mar 2, 2011 at 10:11 AM, Parag Kalra wrote: Sorry for the top post. I should have done bottom post. :( # Untested > use strict; > use warnings; > > open my $fh, '<', my_file; > while(<$fh>){ > if ($_ !~ /my_string/) { > # Do somethin

Re: Testing File Contents

2011-03-02 Thread Parag Kalra
# Untested use strict; use warnings; open my $fh, '<', my_file; while(<$fh>){ if ($_ !~ /my_string/) { # Do something } } The other way would be on shell - # Untested grep my_string my_file if [ $? -eq 1 ] then echo "Do something" fi ~Parag On Wed, Mar 2, 2011 at 9:55 AM,

Re: string substitution command question

2011-02-26 Thread Parag Kalra
On Sat, Feb 26, 2011 at 12:56 PM, Uri Guttman wrote: > >>>>> "PK" == Parag Kalra writes: > > >> why are you doing s/// against $_? by default it does that. > > you didn't rectify this one. > Oops. Missed that. > > > PK

Re: string substitution command question

2011-02-26 Thread Parag Kalra
On Sat, Feb 26, 2011 at 12:34 PM, Uri Guttman wrote: > >>>>> "PK" == Parag Kalra writes: > > PK> use strict; > PK> use warnings; > PK> while(){ > PK> chomp; > > why are you chomping here when you add in the \n later? > Ag

Re: string substitution command question

2011-02-26 Thread Parag Kalra
use strict; use warnings; while(){ chomp; if ($_ =~ /NM_(\d+)/){ my $found = $1; $_ =~ s/$found/$found:12345/g; print "$_\n"; } else { print "$_\n"; } } __DATA__ chr1ucscexon226488874 226488906 0.00 - . gene_id

Re: auto login to remote server using Net::SSH::Expect

2011-02-23 Thread Parag Kalra
1. What error message do you get 2. Could you try the script with strict and warnings. 3. Could you also use die and $! 4. Did you check sshd logs on the server ~Parag On Tue, Feb 22, 2011 at 11:51 PM, Agnello George wrote: > Hi > > i am able to run a command on the remote machine but i am no

Re: Access single element of AOH

2011-02-21 Thread Parag Kalra
print $object->[$stp]->{'lieferung'},"\n"; ~Parag On Mon, Feb 21, 2011 at 12:46 AM, HACKER Nora wrote: > Hello, > > I want to get the value of a key of a Hash that is part of an Array of > Hashes, whereas the correct hash to work with is being determined by the > value of another key which is

Re: Assistance with regular expression

2011-02-14 Thread Parag Kalra
What you should probably do is to use hashes. Something like this: 1. Read the first file. 2. Split the each item of first file using an hyphen 3. Store the first item as the keys of hash say - file1_hash 4. Read the second file and store the items as the keys of a new hash say - file2_hash 5. Lo

Re: about return

2011-02-09 Thread Parag Kalra
Is this what you mean ($exist) ? return 1 : return undef I think even this should work ($exist) ? 1 : 0; ~Parag 2011/2/9 terry peng > > hello, > > when in the case "return undef" I prefer just "return" coz in list context > it will return an empty list. > > my $exist = ... > if ($exist) {

Re: reference noob

2011-02-03 Thread Parag Kalra
print "$field\n" ~Parag 2011/2/3 Téssio Fechine > The program: > -- > #use strict; > use warnings; > > my $field = shift @ARGV; > my $regex = '(\w+)\s*' x $field; > > while () { >if (/$regex/) { >print "$$field\n"; # refers to a match variable >} > } > --

Re: help with zip files and file sizes

2011-01-31 Thread Parag Kalra
You should probably use a Zip parser - http://search.cpan.org/search?mode=module&query=Archive%3A%3AZip ~Parag On Mon, Jan 31, 2011 at 11:15 PM, Balachandran Sivakumar < benignb...@gmail.com> wrote: > Hi, > > I have 2 versions of a zip file(same archive, but with updates.). > I need to co

Re: Need help with Use of uninitialized value in concatenation (.) or string

2011-01-27 Thread Parag Kalra
When you are already storing the line under $line >>>while(( my $line = )) { Then why are you using $_ >>>my @fields = split '\|', $_; Cheers, Parag On Thu, Jan 27, 2011 at 12:57 PM, CM Analyst wrote: > Hello, > > In the following script my goal is pull the date value each time an error > va

Re: Need help in Expect Module

2011-01-19 Thread Parag Kalra
Snippet of what I understand from your requirement: parag@ubuntu-studio:~$ cat app #!/bin/bash if [ $# -ne 1 ] then echo -e "Invalid number of input\nUsage: app " exit 1 else input=$1 fi if [ $input != "register" ] then echo "Invalid choice" exit 1 fi echo "mac" echo "windoze

Return value from function

2011-01-12 Thread Parag Kalra
Hi, On shell, successful command returns exit status of 0. As a best practice what status value shall a Perl function return. Going by the fact that Perl function returns the value of last command in it, I think function should return non-zero for a success. Cheers, Parag -- To unsubscribe, e

Re: Out of memory, HTML::TableExtract

2011-01-06 Thread Parag Kalra
> Maybe because you aren't closing each file after you have done your thing > and it remains in memory? Well I may be wrong but I think since he is using same file handler for each file, new instance is over writing the older one so all files cannot remain opened and hence cannot be in memory. I

Re: Function to print Object properties

2011-01-06 Thread Parag Kalra
Awesome. Thanks Alan and Shawn Cheers, Parag On Thu, Jan 6, 2011 at 6:52 PM, Alan Haggai Alavi wrote: > Hi Parag, > > On Friday 07 January 2011 07:55:38 Parag Kalra wrote: >> Anyways I want to know is there any function or a way that would >> reveal all the pro

Re: Function to print Object properties

2011-01-06 Thread Parag Kalra
Thanks it worked. :) Cheers, Parag On Thu, Jan 6, 2011 at 6:31 PM, Shawn H Corey wrote: > On 11-01-06 09:25 PM, Parag Kalra wrote: >> >> For example if I have a package say Foo::Bar. Now assume that there is >> a object called $fob and pretend that I don't know that

Function to print Object properties

2011-01-06 Thread Parag Kalra
Hi, This question is related to OOPs in Perl and I am learning and enjoying it gradually. Anyways I want to know is there any function or a way that would reveal all the properties of the object. For example if I have a package say Foo::Bar. Now assume that there is a object called $fob and pret

Re: Getting LineFeed for Excel within q quoted field

2011-01-06 Thread Parag Kalra
ly on Unix then modify the fourth line of the above script to binmode($fh,':crlf') Cheers, Parag On Wed, Jan 5, 2011 at 3:48 PM, Wagner, David --- Senior Programmer Analyst --- CFS wrote: > Original Message- >>From: Parag Kalra [mailto:paragka...@gmail.com] >>Sen

Re: Getting LineFeed for Excel within q quoted field

2011-01-05 Thread Parag Kalra
--- CFS wrote: > >>-Original Message- >>From: Parag Kalra [mailto:paragka...@gmail.com] >>Sent: Wednesday, January 05, 2011 12:13 >>To: Wagner, David --- Senior Programmer Analyst --- CFS >>Cc: Perl Beginners >>Subject: Re: Getting LineFeed for Excel

Re: automation frameworks

2011-01-05 Thread Parag Kalra
For what kind of testing are you looking frameworks? Frameworks may differ for Database testing, Protocol testing, Storage Testing etc I believe putting arch or functional spec of any framework in one email would be tough for anyone and also not sure if anyone would share that because of complian

Re: Getting LineFeed for Excel within q quoted field

2011-01-05 Thread Parag Kalra
It may have to do something how you are opening the file handler of CSV file. The data you seen in the csv file may depend on which encoding you have used while creating the file. Couple of questions: 1. I believe currently you are view the file on Windoze, when you view the file on Unix, do you

Re: advangtes of Perl on various languages

2011-01-03 Thread Parag Kalra
> - What all advantages Perl has on top of other scripting languages like > Python , shell , Java ? Its a never ending argument but the best advantage of Perl (according to me) is light weight, very fast, Open Source, CPAN modules, excellent documentation, small and easy way to do complex thing an

Re: 1st line of perl script

2011-01-03 Thread Parag Kalra
Thats called Sha-Bang header also called Magical Bytes. They come into picture when you do not specify the interpreter while executing the script. EG: ./my_script.pl (here no interpreter is specified i.e perl is missing) In this case, script uses the interpreter specified at sha-bang header. An

Re: perl training material and excercises for freshers

2011-01-03 Thread Parag Kalra
For beginners and exercises I would always recommend Learning Perl ( http://oreilly.com/catalog/9780596001322 ) The good thing about the book for trainers is that it gives you an approximation each topic would take to teach and the time required to complete the exercises. You can also purchase it

Re: Increment Operators

2011-01-02 Thread Parag Kalra
That means: $a = $a * 2 i.e take the existing value of $a, multiply it with 2 and reassign it to $a Cheers, Parag On Sun, Jan 2, 2011 at 4:00 PM, J. S. John wrote: > Hi all, I'm new to Perl. The only other language I know is > Matlab/Octave and I'm still working my way around Linux. I am usi

Re: Determining current function name

2010-12-30 Thread Parag Kalra
Thanks Shawn and Jim. caller(0) did the trick. Cheers, Parag On Thu, Dec 30, 2010 at 8:11 PM, Jim Bauer wrote: > On Thu, 30 Dec 2010 18:30:04 -0800, Parag Kalra wrote: >> Hi, >> >> Just like $0 reveals the current script name is there any variable >> using which

Re: Determining current function name

2010-12-30 Thread Parag Kalra
I have already tried that. Specially - caller(3) but it returns the details of the caller i.e from where it was called and no particular details of where it is in. Cheers, Parag On Thu, Dec 30, 2010 at 6:50 PM, Kenneth Wolcott wrote: > On Thu, Dec 30, 2010 at 18:30, Parag Kalra wr

Determining current function name

2010-12-30 Thread Parag Kalra
Hi, Just like $0 reveals the current script name is there any variable using which I can find the current sub-routine I am currently in. Snippet of what I am looking for: use strict; use warnings; sub foo_bar () { print "You are currently using the function - $\n"; } &foo_bar; Cheers, P

Re: Behavior of Regex modifier /x

2010-12-27 Thread Parag Kalra
Thanks All. With all these examples, now I see how /x works. Cheers, Parag On Mon, Dec 27, 2010 at 2:39 PM, Tim Mitchell wrote: > Try my $str = "HelloWorld"; > > On Mon, Dec 27, 2010 at 2:34 PM, Parag Kalra wrote: >> >> Hi, >> >> I was under the

Behavior of Regex modifier /x

2010-12-27 Thread Parag Kalra
Hi, I was under the impression that regex modifier '/x' ignores the white space. So in following script both the if-else blocks should print "Match" since the strings differ only in white space and '/x' should ignore the white space. But looks like my understanding of '/x' is wrong. Could someone

Re: Perl Books

2010-12-26 Thread Parag Kalra
Learning Perl by Randal and Group - http://oreilly.com/catalog/9780596001322 Must must read book for any beginner. Cheers, Parag On Sun, Dec 26, 2010 at 10:54 AM, SERIER wrote: > What are some of the best books for newbies to perl? > > > -- > To unsubscribe, e-mail: beginners-unsubscr...@per

Re: using grep and hash to delete duplicate elements from an array

2010-12-19 Thread Parag Kalra
The approach to remove duplicate items looks good and to get rid of files having same names but different paths, may be you can split the the path name items using a forward slash (/) and then try to grep if the last item (file name) is already a existing file and if it is then skip it. Cheers, Pa

Re: Split function

2010-11-28 Thread Parag Kalra
>>How do i split a value like this >>F:\test\test123\test1233 use strict; use warnings; my $str='F:\test\test123\test1233'; my @values = split /\\/, $str; print "@values"; Cheers, Parag On Sun, Nov 28, 2010 at 1:54 AM, Chaitanya Yanamadala < dr.virus.in...@gmail.com> wrote: > How do i split a

Re: xls files in perl

2010-11-12 Thread Parag Kalra
>From professional experience, I would recommend: Spreadsheet::ParseExcel Cheers, Parag On Thu, Nov 11, 2010 at 7:09 AM, Anush wrote: > Is there any code for reading an xls file in perl. > I found the following code from net, but it does not work. Please help > me. > > > #!/usr/bin/perl -w >

Re: chromatic's "Modern Perl" book is out.

2010-11-12 Thread Parag Kalra
Thanks for the update Shlomi. Had already started reading this book (draft version) on your earlier recommendation. Will continue to it from this final version. Its a good book. Thanks once again for sharing the information. Cheers, Parag On Fri, Nov 12, 2010 at 5:50 AM, Shlomi Fish wrote:

Re: Database table load utility

2010-11-08 Thread Parag Kalra
>>I'm in the thinking stages of creating a table-load utility, which reads a tab-separated CSV file and inserts or updates rows in a >>relational table (probably Oracle). I don't think that will be too hard, having used Perl DBI/DBD modules in the past. Since you are planning to design your own t

Re: error opening file with open function

2010-11-07 Thread Parag Kalra
Instead of taking the file as an input parameter, try to parse the file by hard coding its name in the script and let us know the outcome. Cheers, Parag On Sun, Nov 7, 2010 at 6:00 PM, J M wrote: > Hi all, > > I'm having great issues with my program at the moment... it is supposed to > take a

Re: Please suggest a good book on perl

2010-10-23 Thread Parag Kalra
Ok. Are you referring to the one by Michael Saltzman Btw I would also like to thank brain d foy for such a good book 'learning perl' Sent from my iPhone On Oct 23, 2010, at 3:00 PM, Brian Fraser wrote: I was on your exact same situation a couple of weeks ago. Personally, I tackled Programming

Please suggest a good book on perl

2010-10-23 Thread Parag Kalra
Hey All, Just finished reading 'intermediate perl' Enjoyed it as much as I enjoyed the book 'learning perl' Thanks Randal, Tom & All Please now suggest another must read nook on perl. Sent from my iPhone -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail

Re: split log file

2010-10-16 Thread Parag Kalra
use strict; use warnings; my %log; while(){ chomp; my ($key, $value) = split /;/, $_; push @{$log{$key}}, $value; } foreach my $k (keys %log){ open my $k_fh, '>', "$k.log" or die "Could not open the file - $k.log : $! \n"; foreach my $v (@{$log{$k}}) { print $k_f

Re: Problem reading files

2010-10-16 Thread Parag Kalra
Hi Kryten, Could you please post a sample content of the file and the actual content that is being displayed by the script on your editor. Also kind send the output of following script and check if its same as your previous output. #!/usr/bin/perl use strict; use warnings; use diagnostics; #ope

Re: perl real life exercise

2010-10-15 Thread Parag Kalra
I would suggest few things: 1. Maximum participation at perlmonks.org and beginners@perl.org (Not just asking questions but monitoring these forums to answer as much as you can) 2. Using Perl, try to automate every computer related tasks which you do frequently at your work place or may be at home

Re: How to parse email header

2010-10-12 Thread Parag Kalra
And in case : could also be present as a part of data, you should probably look for regex as a delimiter for the split operation. Cheers, Parag On Tue, Oct 12, 2010 at 10:05 AM, Parag Kalra wrote: > Ok. > > I think simpler option here would be: > > 1. Assign the email hea

Re: How to parse email header

2010-10-12 Thread Parag Kalra
Ok. I think simpler option here would be: 1. Assign the email header string to a variable. 2. Split the variable (using delimiter : ) and assign the list values to a hash. 3. Keys of this hash would be the field attributes and values would be the actual values. 4. You can then either apply regex

Re: How to parse email header

2010-10-12 Thread Parag Kalra
Could you please post an actual example of your email header. Cheers, Parag On Tue, Oct 12, 2010 at 9:20 AM, S Pratap Singh wrote: > Hello , > > I am trying to write a script which can parse email header and based on > certain criteria/parameter it will update the email subject detail in the

Re: Finding characters from the file encoded with - ISO8859_1

2010-10-07 Thread Parag Kalra
By range I mean: http://htmlhelp.com/reference/charset/iso224-255.html Cheers, Parag On Thu, Oct 7, 2010 at 2:17 PM, Parag Kalra wrote: > Hi All, > > I have a file encoded with ISO8859_1 > > I wish to find and print all the characters from a certain range say > between 2

Finding characters from the file encoded with - ISO8859_1

2010-10-07 Thread Parag Kalra
Hi All, I have a file encoded with ISO8859_1 I wish to find and print all the characters from a certain range say between 224 and 255 ord function doesn't seem to work here. Any other work around. Cheers, Parag

Re: perl

2010-10-04 Thread Parag Kalra
Where do you want to login? I believe you are already subscribed to the list. Is this your first post? Please post your exact question. Cheers, Parag On Mon, Oct 4, 2010 at 9:49 AM, sheikh numan iqbal wrote: > hi, > > i want to login and need help on perl... > > regards, > numan >

My first attempt to design a module

2010-10-03 Thread Parag Kalra
Hi All, I am planning to design a small module that would make use of object oriented concepts of Perl. Since its my first attempt in the field of Oops, I would request Perl experts to review the code design as and when I would share the new piece of development for this module. Basic idea of th

Re: No Output in Terminal

2010-09-30 Thread Parag Kalra
Thats ^M character. You can get rid of them using vi: :%s/^M//g Cheers, Parag On Thu, Sep 30, 2010 at 8:26 PM, Mark wrote: > On 9/30/10 10:59 PM, Chas. Owens wrote: > >> The only thing I can do to reproduce what you are seeing is to place a >> control-d (aka ASCII character 4) in the file.

Re: No Output in Terminal

2010-09-30 Thread Parag Kalra
Few questions/suggestions: Which shell are you on? i.e echo $SHELL whats the location of the perl binary: i.e which perl Can you invoke the program using 'use strict' and let us know the output Can you try this: perl -e 'print "Hello World"' Cheers, Parag On Thu, Sep 30, 2010 at 7:25 PM, Mark

How to get the Pause ID

2010-09-29 Thread Parag Kalra
Hi All, I have been trying to get Pause ID but seems like either the request is getting rejected or something is wrong in the way I am raising the request. I have applied twice in past. EG: http://www.nntp.perl.org/group/perl.modules/2010/09/msg72805.html Could someone please share some pointer

Re: Good Perl Books

2010-09-24 Thread Parag Kalra
>>>Learning Perl >>>by Randal L. Schwartz, Tom Phoenix, and brian d foy >>>ISBN 0-596-52010-7 [5th edition June 2008] >>>http://oreilly.com/catalog/9780596520106/ Must must must read book for any beginner. Cheers, Parag On Fri, Sep 2

Re: Web UI Automation

2010-09-23 Thread Parag Kalra
Selenium does provide Perl support. http://release.seleniumhq.org/selenium-remote-control/1.0-beta-2/doc/perl/WWW-Selenium.html Cheers, Parag On Thu, Sep 23, 2010 at 8:40 AM, Jatin wrote: > Hi > > I wanted to know if the UI automation for websites is possible using perl. > I did some search o

Re: Interrupt Handling

2010-09-22 Thread Parag Kalra
$retval = `/$ENV{'ORACLE_HOME'}/bin/sqlplus -s $QUERY_STRING << EOF >> One question out of curiosity. Actually 2 questions: 1. I am not sure if -s is a valid sqlplus option. I have always used -S to operate in silent mode. I am using SQL*Plus: Release 10.2.0.4.0 - Production 2. Is there any

Re: how to concatenate two lists

2010-09-20 Thread Parag Kalra
#!/usr/bin/perl use strict; use warnings; my @ar = ("rahul","patil"); my @ar1 = ("nitin"); my @ar4; push @ar4, (@ar, @ar1); print "@ar4"; Cheers, Parag On Mon, Sep 20, 2010 at 12:49 AM, rahul patil wrote: > Hello all, > > below is sample code i have written.Is it right way to declare ar4 whi

Re: One query

2010-09-19 Thread Parag Kalra
Hope this helps: #!/usr/bin/perl # Author: Parag Kalra # Date: 19-SEPT-2010 use strict; use warnings; my %mean_values; while(){ chomp; my ($key, $value) = split (/\t/,$_); if ( exists $mean_values{$key} ){ push @{$mean_values{$key}}, $value; } else { ${$mean_values{$key

How to use the module: XML::Parser

2010-05-10 Thread Parag Kalra
Hey All, I am trying to design some scripts using the module - XML::Parser To start learning I have a very basic scenario. Suppose I have following XML file: My Tag1 My Tag2 My Tag3 I want to save the the tags as the keys of a Hash and respective content as the value of that hash So for th

Perl modules to process PDF files

2010-05-03 Thread Parag Kalra
Hi All, I need to process some PDF files to do some complex validation (like checking the colour of icons, position etc). I was wondering if Perl comes with some handy modules to process PDF files? AFAIK even professional tools like QTP are not good with processing PDF files. Cheers, Parag

Re: Interactive shell in Perl

2010-05-01 Thread Parag Kalra
I installed psh but getting following error after launching it: Cannot find termcap: TERM not set at C:\perl\lib/Term/ReadLine.pm line 351 Cheers, Parag On Wed, Apr 28, 2010 at 7:45 AM, John W. Krahn wrote: > Parag Kalra wrote: > >> Hey All, >> > > Hello, > >

Re: Redirecting the Output and Error of Perl script

2010-05-01 Thread Parag Kalra
Thanks all... I was printing in normal fashion. I should have used something lik: print STDERR "stderr\n"; as suggested by all. Cheers, Parag On Sat, May 1, 2010 at 1:55 AM, Philip Potter wrote: > On 30 April 2010 18:45, Parag Kalra wrote: > > Hey All, > > >

Redirecting the Output and Error of Perl script

2010-04-30 Thread Parag Kalra
Hey All, I am trying to execute a Perl via shell script. I want to redirect output of Perl script to one file and error occured (if any) to other file. This is the snippet from my shell script: perl output_error.pl 1>> Report.log 2>>Error.log However even normal print messages are going to Erro

Interactive shell in Perl

2010-04-27 Thread Parag Kalra
Hey All, Wanted to know if Perl has any interactive shell (just like Python, Bash, Ruby etc have) by any chance. And if yes how do we invoke that. Cheers, Parag

Re: File Type

2010-04-13 Thread Parag Kalra
In case you are working on Unix, you can call the command on '*file*' through Perl's function - '*system*' Cheers, Parag On Tue, Apr 13, 2010 at 9:52 AM, Arun P Menon wrote: > Hi All, > > Could you tell which is the best perl module for finding file type? > > I am currently using File::Type b

How to create DSN on Solaris for Win32::ODBC

2010-04-08 Thread Parag Kalra
Hi All, I am planing to use Win32::ODBC to connect to SQL Server from Solaris through Perl. I know how to create DSN on Windows. But doesn someone have any idea how I can create dsn for Win32::ODBC on Solaris. I am planning to use following: bash-3.00$ pwd /opt/oracle/product/10.2.0.4.0/perl/li

How to convince the Customer

2010-03-17 Thread Parag Kalra
Hey All, I am facing this situation where I have coded a Perl framework on Windows and its all working fine. The framework mostly uses DBI and ODBC module to connect to both Oracle server, execute SQL queries, fetch Rows etc etc. Now the customer wants to use the framework on a Solaris machine (i

Re: Any Good SCM tool to manage Perl Code locally

2010-03-15 Thread Parag Kalra
Yes I have started using Git and I am very happy with it so far. Just couple of questions - How can I make my code readonly using Git such that it can be edited only when it is checked out. Also if I want to take entire code base to particular revision, I guess I need to use - 'git checkout '. S

Any Good SCM tool to manage Perl Code locally

2010-03-13 Thread Parag Kalra
Hi All, Although it is not related to Perl directly and might be little strange question but still thought of consulting Perl gurus. Here is the thing - I mainly code in Perl and Bash and I don't use any SCM tool. And the reason I don't use it is because even if I configure a SCM server - I shoul

Re: regex support for glob

2010-01-20 Thread Parag Kalra
On the same lines I have question to all Perl Gurus. In this scenario can we following? And if Yes, how efficient it is? #!/usr/bin/perl #Author: Parag Kalra use strict; use warnings; # Creating 50 files - you can skip this foreach(1..50){ open my $fh, '>', 'file.'.$_

  1   2   >