Compare elements in an array.

2010-11-02 Thread Chaitanya Yanamadala
hai i have an hash array with me. which is some what like this. ' '123D3B434829C090.zon' => { '6' => { 'headline' => 'Lambertville Girl Is Stationed At Prague'

Re: redirect STDERR

2010-11-02 Thread C.DeRykus
On Nov 2, 5:06 pm, bryan_r_har...@raytheon.com (Bryan R Harris) wrote: > I have these lines in my script: > > ** > for my $handle (*STDIN, *STDERR) { >     open($handle, "+ /dev/null: $!.  Exiting.\n"; > > } > > # open outfile for further recording > open(STDOUT,

About perl ftp problem

2010-11-02 Thread sync
Hi, all : I want to write the script to monit the ftp users actions on time, The website is the best . like this : users time actions test121:23 download the test file test221:30 downlo

How to compare 2 elements in an array

2010-11-02 Thread Sri
Hi I am trying to figure out how can we compare two index values of two strings in the same array, so that if the 1st argument index value is less than second argument index value, I want to swap the input arguments.Please help me with that. I successfully got the index values for the given input

Re: Checking the number of arguments passed to a Perl Program

2010-11-02 Thread David Christensen
Sri wrote: > Hi - I have just started with Perl and would need your help on this. > I am trying to write a program which expects two strings(arguments) > from the end user (no less, no more) and I would like to check if the > end-user did pass only two arguments. I am using the code below for > th

redirect STDERR

2010-11-02 Thread Bryan R Harris
I have these lines in my script: ** for my $handle (*STDIN, *STDERR) { open($handle, "+$outfile") or die "$me: Couldn't open $outfile: $!\n"; $| = 1; # and don't buffer it ** I decided I want STDERR to also be

Re: Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread C.DeRykus
On Nov 2, 3:50 am, h...@risoe.dtu.dk ("Larsen, Henning Engelbrecht") wrote: > I want to search a string for patterns but starting the search from the > _end_ instead of from the beginning, using a regular expression. > > For instance I want to find the last 'E' in the string > > ...looong string po

Re: Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread Akhthar Parvez K
On Wednesday 03 Nov 2010, Uri Guttman wrote: > > try: 'E123EEExyz' > > your \b at the end also breaks many cases. > > perl -le 'print $1 if ("EE123EExyz" =~ /.*(E)\d*\b/)' > perl -le 'print $1 if ("EE123abc" =~ /.*(E)\d*\b/)' > perl -le 'print $1 if ("EE123EExyzE" =~ /.*(E)\d*\b/)' > E > >

Re: Re: checking if a file is in use

2010-11-02 Thread perl_haxor 123
Hi All, Thanks a lot for the suggestion, It looks like flock is used if my perl script want to lock a file, In this case the perl script would be copying files from one directory to an another one, but some process (let say xyz process) might be using these files, in that case i don't wa

Re: Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread Uri Guttman
> "APK" == Akhthar Parvez K writes: APK> Hi Uri, APK> On Wednesday 03 Nov 2010, Uri Guttman wrote: APK> $catch = $1 if ($string =~ /.*(E)\d*\b/); >> >> he didn't say there will be digits at the end. what if there aren't? his >> example was just random text following the last E.

Re: Subroutine question: Placement of subroutine definitions matter?

2010-11-02 Thread Akhthar Parvez K
On Wednesday 03 Nov 2010, Uri Guttman wrote: > the recommended style IS to call subs with (). where did you get the > opposite idea? As I said, I think I'd read it somewhere. Yeah, may be that was required with only Perl 4 or earlier. > APK> I remember I'd read in the past that & should be us

Re: Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread Akhthar Parvez K
Hi Uri, On Wednesday 03 Nov 2010, Uri Guttman wrote: > APK> $catch = $1 if ($string =~ /.*(E)\d*\b/); > > he didn't say there will be digits at the end. what if there aren't? his > example was just random text following the last E. It will match even if there are no digits at the end: input:

Re: Subroutine question: Placement of subroutine definitions matter?

2010-11-02 Thread Uri Guttman
> "APK" == Akhthar Parvez K writes: APK> On Sunday 31 Oct 2010, Shlomi Fish wrote: APK> [ snipped ] >> > &testsub1(); >> >> Don't use leading ampersands in subroutine calls: APK> Suppose a subroutine definition is written down the line and it's APK> called without (), which is

Re: Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread Uri Guttman
> "APK" == Akhthar Parvez K writes: APK> Hi Henning, APK> $catch = $1 if ($string =~ /.*(E)\d*\b/); APK> you can use this to test it: APK> $catch = $1 if ($string =~ /.*(E\d*)\b/); he didn't say there will be digits at the end. what if there aren't? his example was just random text

Re: how to remove (^M ^G ) characters

2010-11-02 Thread John W. Krahn
Mike McClain wrote: Hi John, Thank you for your comments. Though I've been coding for many years I've never had a chance to work in a team environment and thus never had the benefit of code reviews. It's an education to see things from another viewpoint. On Sat, Oct 30, 2010 at 03:16:5

Re: Subroutine question: Placement of subroutine definitions matter?

2010-11-02 Thread Akhthar Parvez K
On Sunday 31 Oct 2010, Shlomi Fish wrote: [ snipped ] > > &testsub1(); > > Don't use leading ampersands in subroutine calls: Suppose a subroutine definition is written down the line and it's called without (), which is the recommended style: &SubRoutine or SubRoutine I remember I'd read in the

Re: Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread Akhthar Parvez K
Hi Henning, $catch = $1 if ($string =~ /.*(E)\d*\b/); you can use this to test it: $catch = $1 if ($string =~ /.*(E\d*)\b/); -- Regards, Akhthar Parvez K http://www.sysadminguide.com/ UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity - Dennis

Re: Checking the number of arguments passed to a Perl Program

2010-11-02 Thread John W. Krahn
Sri wrote: Hi - I have just started with Perl and would need your help on this. Hello, I am trying to write a program which expects two strings(arguments) from the end user (no less, no more) and I would like to check if the end-user did pass only two arguments. @ARGV == 2 or die "usage: $0

Fwd: Re: checking if a file is in use

2010-11-02 Thread shawn wilson
-- Forwarded message -- From: "shawn wilson" Date: Nov 2, 2010 3:12 PM Subject: Re: checking if a file is in use To: "perl_haxor 123" perlmonks has a nice article on file locks in general that might be useful to you. i assume what you want to do is lock the file or die. http://ww

Re: checking if a file is in use

2010-11-02 Thread Shlomi Fish
Hi Monnappa, On Tuesday 02 November 2010 20:49:04 perl_haxor 123 wrote: > Hi All, > > I have a directory in which i have multiple files, i have to read > each one of them and parse the data..but there could be some files > which are in use by some other program, how can i find which

Re: checking if a file is in use

2010-11-02 Thread Jim Gibson
On 11/2/10 Tue Nov 2, 2010 11:49 AM, "perl_haxor 123" scribbled: > Hi All, > > I have a directory in which i have multiple files, i have to read > each one of them and parse the data..but there could be some files which > are in use by some other program, how can i find which fil

checking if a file is in use

2010-11-02 Thread perl_haxor 123
Hi All, I have a directory in which i have multiple files, i have to read each one of them and parse the data..but there could be some files which are in use by some other program, how can i find which files are in use by other program in perl?...any suggestions would be really h

Re: need help with XML::Simple

2010-11-02 Thread galeb abu-ali
You're right, my path is messed up, I have SAX installed. I tried to move stuff around and when I run the script I get a new error message: Can't locate loadable object for module XML::LibXML in @INC (@INC contains: /usr/local/lib/perl5/site_perl/5.12.2/x86_64-linux-multi /usr/local/lib/perl5/site_

Re: Checking the number of arguments passed to a Perl Program

2010-11-02 Thread David Christensen
Sri wrote: > Hi - I have just started with Perl and would need your help on this. > I am trying to write a program which expects two strings(arguments) > from the end user (no less, no more) and I would like to check if the > end-user did pass only two arguments. I am using the code below for > th

Re: Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread Jim Gibson
At 11:50 AM +0100 11/2/10, Larsen, Henning Engelbrecht wrote: I want to search a string for patterns but starting the search from the _end_ instead of from the beginning, using a regular expression. Not a regular expression, but if all you are looking for is a substring, use rindex: perldoc

Re: Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread Robert Wohlfarth
On Tue, Nov 2, 2010 at 5:50 AM, Larsen, Henning Engelbrecht < h...@risoe.dtu.dk> wrote: > I want to search a string for patterns but starting the search from the > _end_ instead of from the beginning, using a regular expression. > > Try something like this: $string = "...looong string possibly wi

Re: Checking the number of arguments passed to a Perl Program

2010-11-02 Thread Shlomi Fish
Hi Sri, a few comments on your code. On Tuesday 02 November 2010 07:08:41 Sri wrote: > Hi - I have just started with Perl and would need your help on this. > > I am trying to write a program which expects two strings(arguments) > from the end user (no less, no more) and I would like to check if t

Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread Larsen, Henning Engelbrecht
I want to search a string for patterns but starting the search from the _end_ instead of from the beginning, using a regular expression. For instance I want to find the last 'E' in the string ...looong string possibly with many E's...E.no capital e' here...3456 The regular expressi

Re: AW: Variable variable names

2010-11-02 Thread Shlomi Fish
Hi Nora, On Tuesday 02 November 2010 10:38:03 HACKER Nora wrote: > Hi Shlomi, > > > Instead of calling your variables $sql_$kurz and $sth_$kurz, etc. put > > them in > > > %umg hash or a different one - possibly referenced by keys of a hash > > reference or slots of an object: > > > > {{{ > >

AW: Variable variable names

2010-11-02 Thread HACKER Nora
Hi Shlomi, > Instead of calling your variables $sql_$kurz and $sth_$kurz, etc. put them in > %umg hash or a different one - possibly referenced by keys of a hash > reference or slots of an object: > > {{{ > my $lang_sql = $runtime_data{$lang} = NoraSqlObject->new; > > $lang_sql->sql( > "s