Re: perl compilation issue - using global variable

2008-11-20 Thread Chas. Owens
On Fri, Nov 21, 2008 at 01:55, ashish nainwal <[EMAIL PROTECTED]> wrote: > I am using perlcc to compile perl script Yeah, that is a bad idea. from http://search.cpan.org/~nwclark/perl-5.8.8/utils/perlcc.PL: The code generated in this way is not guaranteed to work. The whole codegen suite (perlcc

Re: regex {1,}

2008-11-20 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi, Hello, I am trying to use a regular expression to search for some words in a file after a few particular words/characters. Once I find the words I am looking for, I want to print only those words. Here's what I'm talking about. while() { if (/Someth

Re: printing element from a 'split' file

2008-11-20 Thread mark.baumeist...@gmail.com
On Nov 19, 7:55 am, [EMAIL PROTECTED] (John W. Krahn) wrote: > [EMAIL PROTECTED] wrote: > > Hi, > > Hello, > > > > > > > I am trying to split a file (where there are one or more spaces) that > > I am getting through a file handle that is fed into an array and then > > printing each element of the a

Re: regexp - end of line question

2008-11-20 Thread John W. Krahn
sftriman wrote: I have data such as: A|B|C|44 X|Y|Z|33,44 C|R|E|44,55,66 T|Q|I|88,33,44 I want to find all lines with 44 in the last field. I was trying: /[,\|]44[,\$]/ which logically is perfect - but the end of line \$ doesn't seem right. How do I write: comma or pipe followed by 44 foll

regex {1,}

2008-11-20 Thread mablfm
Hi, I am trying to use a regular expression to search for some words in a file after a few particular words/characters. Once I find the words I am looking for, I want to print only those words. Here's what I'm talking about. while() { if (/Something\s>\s(\w+)/) { print "1$

regexp - end of line question

2008-11-20 Thread sftriman
I have data such as: A|B|C|44 X|Y|Z|33,44 C|R|E|44,55,66 T|Q|I|88,33,44 I want to find all lines with 44 in the last field. I was trying: /[,\|]44[,\$]/ which logically is perfect - but the end of line \$ doesn't seem right. How do I write: comma or pipe followed by 44 followed by comma or e

Need help on simple auto-boot question

2008-11-20 Thread statmatics
This seems so trivial, but I have not been able to reconcile this question. 1. File names index.html and index.php have special properties in that they auto-boot when a directory on the server is accessed. 2. To run my perl code, which I keep in cgi-bin, I use an index.html that does nothing but

Re: no output Net::SSH2

2008-11-20 Thread monnappa appaiah
Hi, As per you suggestion i removed the last line of the code and the replaced with the code, now the code looks like this -- #!/usr/bin/perl -w use strict; use Net::SSH2; my $ssh2 = Net::SSH2->new();

Re: Million hash comparisons

2008-11-20 Thread Jenda Krynicky
From: Nitin Kalra <[EMAIL PROTECTED]> > All I want to do is to compare 2 hashes having 10-20 > Million key/ value pairs, this means 100-200 Million > comparisons. Hashes are the best thing which come to > my mind but storing hashes in memory overloads the > system and lowers the performance drastic

Re: Million hash comparisons

2008-11-20 Thread Jenda Krynicky
From: Rob Dixon <[EMAIL PROTECTED]> > Jenda Krynicky wrote: > > From: Nitin Kalra <[EMAIL PROTECTED]> > >> > >> In a Perl script of mine I have to compare 2 8M-10M > >> files(each). Which mean 80-90M searches. As a normal > >> procedure (upto 1 M)I use hashes, but going beyond 1M > >> system perfor

Re: help in redirecting output to file

2008-11-20 Thread Brian McCauley
On Nov 20, 2:15 pm, [EMAIL PROTECTED] (Irfan Sayed) wrote: > Hi All, > > Can somebody please help me for this block of code. > > if ("$1" ne "-log"){ > > `$0 -log "$@" 2>&1 | tee the_log_file.$$.log`; > > exit 0; > > } > > I know this code redirects the output of entire perl script to file but > it

Re: can you substitute equation with variable?

2008-11-20 Thread Brian McCauley
On Nov 17, 9:47 am, [EMAIL PROTECTED] (Richard Lee) wrote: > say something like == or eq .. > > Can you sub them w/ varilable like $unknown   ? > > Let me be more specific. > Let's say I don't know what the variable will hold > > I guess I can say something like, > > sub check_unknown { >         m

Re: Quoting hash keys changes things sometimes

2008-11-20 Thread Brian McCauley
On Nov 15, 6:52 pm, [EMAIL PROTECTED] (Kelly Jones) wrote: > Consider: > > perl -le '$hash{"foo-bar"} = 1; print $hash{foo-bar}' > [no result] > > perl -le '$hash{"foobar"} = 1; print $hash{foobar}' > 1 > > I sort of understand this: in the first script, Perl treats foo-bar as > a subtraction, and

Re: How to determine the file type of a file passed as an input to the perl program ?

2008-11-20 Thread John W. Krahn
Amit Saxena wrote: Hi all, Hello, How to determine the file type of a file passed as an input to the perl program ? I want to have the same output as it's shown by "file" command in UNIX. "file" uses a database called /etc/magic to determine the file type. Although on my system it is loca

Re: read multiple csv files into array, do some math

2008-11-20 Thread Stealth
On Thursday 20 November 2008 12:50:23 am Graham Saathoff wrote: > Is this right? Any suggestions for how to build something like > this? I would suggest that you get a copy of this book "Learning Perl" 5th Edition. ISBN: 978-0-596-52010-6 Authors: Randal L. Schwartz, Tom Phoenix & brian d foy (T

Re: help in redirecting output to file

2008-11-20 Thread Nitin Kalra
Why don't u use this code :- open NEW_OUT,">output.txt"; select NEW_OUT; # making output.txt to take the default STD output Hope this helps... BR/Nitin --- [EMAIL PROTECTED] wrote: > > Hi All, > > > > Can somebody please help me for this block of code. > > > > if ("$1" ne "-log"){ >

Re: Determining if a file is more than so many days old

2008-11-20 Thread Brian McCauley
On Nov 20, 3:18 pm, [EMAIL PROTECTED] (AndrewMcHorney) wrote: > I then am going to do a stat > command to find the date the file was created (it is never modified) > and then determine if it is to be deleted. What is the easiest way to > determine if a date is more than x number of days old. A d

Re: Determining if a file is more than so many days old

2008-11-20 Thread Chas. Owens
On Thu, Nov 20, 2008 at 10:18, AndrewMcHorney <[EMAIL PROTECTED]> wrote: > Hello > > I am working on a perl script that will go through a directory and it's > subdirectories and purge all the files that are more than a specified number > of days old. I am using a Unix system so I do a find command

RE: [Fwd: Re: Determining if a file is more than so many days old]

2008-11-20 Thread Andrew Curry
If your on unix you can just use find with -mtime and an exec rm. If all you want to do is perge files. -Original Message- From: Raymond Wan [mailto:[EMAIL PROTECTED] Sent: 20 November 2008 15:39 To: beginners@perl.org Subject: [Fwd: Re: Determining if a file is more than so many days ol

[Fwd: Re: Determining if a file is more than so many days old]

2008-11-20 Thread Raymond Wan
Sorry, forgot to send it to the list... Ray - Hi Andrew, AndrewMcHorney wrote: > I am working on a perl script that will go through a directory and > it's subdirectories and purge all the files that are more than a > specified number of days old. I am using a Unix system so I do a find > c

Re: How to determine the file type of a file passed as an input to the perl program ?

2008-11-20 Thread Chas. Owens
On Thu, Nov 20, 2008 at 07:15, Amit Saxena <[EMAIL PROTECTED]> wrote: snip > Before posting this query here, I indeed did a sample search on CPAN. > > However I want to have a solution using Perl inbuilt module instead of some > external module as the system I am working on does not allows perl ext

RE: Determining if a file is more than so many days old

2008-11-20 Thread Stewart Anderson
> -Original Message- > From: AndrewMcHorney [mailto:[EMAIL PROTECTED] > Sent: 20 November 2008 15:19 > To: beginners@perl.org > Subject: Determining if a file is more than so many days old > > Hello > > I am working on a perl script that will go through a directory and > it's subdirector

Determining if a file is more than so many days old

2008-11-20 Thread AndrewMcHorney
Hello I am working on a perl script that will go through a directory and it's subdirectories and purge all the files that are more than a specified number of days old. I am using a Unix system so I do a find command to gather up the files I want. I then am going to do a stat command to find t

Re: perl compilation issue - using global variable

2008-11-20 Thread Chas. Owens
On Thu, Nov 20, 2008 at 00:05, ashish nainwal <[EMAIL PROTECTED]> wrote: > do u have any such doc..please provide it to me! > > On Thu, Nov 20, 2008 at 10:35 AM, ashish nainwal > <[EMAIL PROTECTED]>wrote: > >> Thanks for the info. I will be using my perl script for AIX but I am not >> able to find

Re: perl compilation issue - using global variable

2008-11-20 Thread Chas. Owens
On Thu, Nov 20, 2008 at 00:05, ashish nainwal <[EMAIL PROTECTED]> wrote: > Thanks for the info. I will be using my perl script for AIX but I am not > able to find a supporting IBM official doc which says that AIX comes with > perl by default. snip What are you using to create the binary? PAR::Pack

Re: How to determine the file type of a file passed as an input to the perl program ?

2008-11-20 Thread Amit Saxena
On Thu, Nov 20, 2008 at 6:59 PM, Raymond Wan <[EMAIL PROTECTED]>wrote: > > Hi Amit, > > > Amit Saxena wrote: > >> On Thu, Nov 20, 2008 at 6:20 PM, Raymond Wan <[EMAIL PROTECTED] >> >wrote: >> >> >>> Hi Amit, >>> >>> >>> Amit Saxena wrote: >>> >>> >>> Using external modules in the home directo

help in redirecting output to file

2008-11-20 Thread Irfan.Sayed
Hi All, Can somebody please help me for this block of code. if ("$1" ne "-log"){ `$0 -log "$@" 2>&1 | tee the_log_file.$$.log`; exit 0; } I know this code redirects the output of entire perl script to file but it is not executing as expected. Can somebody please explain / help Re

Re: perl compilation issue - using global variable

2008-11-20 Thread ashish nainwal
Thanks for the info. I will be using my perl script for AIX but I am not able to find a supporting IBM official doc which says that AIX comes with perl by default. On Thu, Nov 20, 2008 at 10:32 AM, Mr. Shawn H. Corey <[EMAIL PROTECTED]>wrote: > On Thu, 2008-11-20 at 10:23 +0530, ashish nainwal wr

Re: How to determine the file type of a file passed as an input to the perl program ?

2008-11-20 Thread Raymond Wan
Hi Amit, Amit Saxena wrote: On Thu, Nov 20, 2008 at 6:20 PM, Raymond Wan <[EMAIL PROTECTED]>wrote: Hi Amit, Amit Saxena wrote: Using external modules in the home directory is not disallowed, in fact I keep using few CPAN modules from my home directory like PerlTidy etc. However t

Re: no output Net::SSH2

2008-11-20 Thread sisyphus
Monnappa Appaiah wrote: . . > > 1) > > #!/usr/bin/perl -w > use strict; > use Net::SSH2; > > my $ssh2 = Net::SSH2->new(); > $ssh2->connect('sys5') or die "Unable to connect host $@ \n"; > $ssh2->auth_password('xyz','my

Re: perl compilation issue - using global variable

2008-11-20 Thread ashish nainwal
do u have any such doc..please provide it to me! On Thu, Nov 20, 2008 at 10:35 AM, ashish nainwal <[EMAIL PROTECTED]>wrote: > Thanks for the info. I will be using my perl script for AIX but I am not > able to find a supporting IBM official doc which says that AIX comes with > perl by default. > >

Re: perl compilation issue - using global variable

2008-11-20 Thread ashish nainwal
I want to compile a perl script because I want to run it on systems which dont have perl installed. Does creating an executable solve this purpose? If yes, then how can I do that? On Wed, Nov 19, 2008 at 10:38 PM, Mr. Shawn H. Corey <[EMAIL PROTECTED]>wrote: > On Wed, 2008-11-19 at 04:03 -0800, a

Re: How to determine the file type of a file passed as an input to the perl program ?

2008-11-20 Thread Amit Saxena
On Thu, Nov 20, 2008 at 6:20 PM, Raymond Wan <[EMAIL PROTECTED]>wrote: > > Hi Amit, > > > Amit Saxena wrote: > >> Using external modules in the home directory is not disallowed, in fact I >> keep using few CPAN modules from my home directory like PerlTidy etc. >> >> However the reason for which I

Re: How to determine the file type of a file passed as an input to the perl program ?

2008-11-20 Thread Jeff Pang
> Message du 20/11/08 13:39 > De : "Amit Saxena" > A : "Raymond Wan" > Copie à : "Perl Beginners" , "Amit Saxena" > Objet : Re: How to determine the file type of a file passed as an input to > the perl program ? > > If I don't get any module like this, I will be forced to use system ("file") > wh

Re: How to determine the file type of a file passed as an input to the perl program ?

2008-11-20 Thread Raymond Wan
Hi Amit, Amit Saxena wrote: Using external modules in the home directory is not disallowed, in fact I keep using few CPAN modules from my home directory like PerlTidy etc. However the reason for which I want to use an inbuilt module because I need not ask sysadmin people to download and insta

Re: How to determine the file type of a file passed as an input to the perl program ?

2008-11-20 Thread Amit Saxena
On Thu, Nov 20, 2008 at 5:50 PM, Raymond Wan <[EMAIL PROTECTED]>wrote: > > Hi Amit, > > > Amit Saxena wrote: > >> On Thu, Nov 20, 2008 at 4:59 PM, Raymond Wan <[EMAIL PROTECTED] >> >wrote: >> >> >>> Hi Amit, >>> >>> Amit Saxena wrote: >>> >>> Hi all, How to determine the file type o

Re: How to determine the file type of a file passed as an input to the perl program ?

2008-11-20 Thread Raymond Wan
Hi Amit, Amit Saxena wrote: On Thu, Nov 20, 2008 at 4:59 PM, Raymond Wan <[EMAIL PROTECTED]>wrote: Hi Amit, Amit Saxena wrote: Hi all, How to determine the file type of a file passed as an input to the perl program ? I want to have the same output as it's shown by "file" command i

Re: How to determine the file type of a file passed as an input to the perl program ?

2008-11-20 Thread Amit Saxena
On Thu, Nov 20, 2008 at 4:59 PM, Raymond Wan <[EMAIL PROTECTED]>wrote: > > Hi Amit, > > Amit Saxena wrote: > >> Hi all, >> >> How to determine the file type of a file passed as an input to the perl >> program ? >> >> I want to have the same output as it's shown by "file" command in UNIX. >> >> > >

Re: How to determine the file type of a file passed as an input to the perl program ?

2008-11-20 Thread Raymond Wan
Hi Amit, Amit Saxena wrote: Hi all, How to determine the file type of a file passed as an input to the perl program ? I want to have the same output as it's shown by "file" command in UNIX. Try going to CPAN and searching for it. For example, http://search.cpan.org/search?query=file+ty

How to determine the file type of a file passed as an input to the perl program ?

2008-11-20 Thread Amit Saxena
Hi all, How to determine the file type of a file passed as an input to the perl program ? I want to have the same output as it's shown by "file" command in UNIX. Thanks & Regards, Amit Saxena

Re: read multiple csv files into array, do some math

2008-11-20 Thread Raymond Wan
Hi Graham, Graham Saathoff wrote: Is this right? Any suggestions for how to build something like this? Well, you have the right idea in that you're planning out what you are doing. In general, if you have hundreds of files, what you should do depends on how big they are. You mention