RE: How to know no. of times the script has been executed?

2009-01-08 Thread sanket vaidya
Thanks for hint Mike. I think now I will be able to proceed. -Original Message- From: Mike Ward [mailto:m...@farematrix.com] Sent: Thursday, January 08, 2009 9:59 PM To: beginners@perl.org Subject: Re: How to know no. of times the script has been executed? sanket vaidya wrote: > > H

How to check whether user types exit in cmd?

2009-01-08 Thread sanket vaidya
Hi all, I am invoking dos using system 'start cmd /k echo Welcome' in my script Now I want following: If user types exit on does screen { do something } How to check whether user types 'exit' on dos screen. Also I want If user closes the cmd window (by clickin 'x') { do something }

Re: OO confusion

2009-01-08 Thread John W. Krahn
root wrote: The following script gives me confusing results. I've not delved into OOP before and am surprised when something appears to work but gives wrong answers. Explicitly Digest::MD5's md5_hex gives wrong answers if called as Digest::MD5->md5_hex. OK, I've figured out that it shou

Re: Send email using smtp

2009-01-08 Thread Steve Bertrand
Jenda Krynicky wrote: > From: Gunnar Hjalmarsson >> Steve Bertrand wrote: >>> Fúlvio Figueirôa wrote: I solved my problem using sendmail with the code below: open (MAIL, "|/usr/sbin/sendmail -t "); print MAIL "From: someaddr...@somedomain\n"; print MAIL "To: someaddre...@s

Re: recursively find and print non-ascii characters in file

2009-01-08 Thread Chas. Owens
On Thu, Jan 8, 2009 at 14:10, Mike McClain wrote: > On Thu, Jan 08, 2009 at 01:52:02AM +, Rob Dixon wrote: >> Chas. Owens wrote: >> > File::Find::find( >> >> File::Find exports find() by default. It is better either to use the import >> or >> to prevent it altogether with >> >> use File::Fi

Re: OO confusion

2009-01-08 Thread Chas. Owens
On Thu, Jan 8, 2009 at 17:47, root wrote: >The following script gives me confusing results. > I've not delved into OOP before and am surprised when something > appears to work but gives wrong answers. >Explicitly Digest::MD5's md5_hex gives wrong answers if called as > Digest::MD5->md5_hex

Re: recursively find and print non-ascii characters in file

2009-01-08 Thread Mike McClain
On Thu, Jan 08, 2009 at 01:52:02AM +, Rob Dixon wrote: > Chas. Owens wrote: > > File::Find::find( > > File::Find exports find() by default. It is better either to use the import or > to prevent it altogether with > > use File::Find (); > > in the first place. > > Rob In what way is it be

OO confusion

2009-01-08 Thread root
The following script gives me confusing results. I've not delved into OOP before and am surprised when something appears to work but gives wrong answers. Explicitly Digest::MD5's md5_hex gives wrong answers if called as Digest::MD5->md5_hex. OK, I've figured out that it shouldn't be calle

perl books

2009-01-08 Thread Mike McClain
I have 'Programming Perl' and 'Learning Perl' and was fortunate enough to get 2 copies of 'Perl Cookbook' for Christmas, one of which I plan to return for exchange. After looking over O'Reilly's offerings I've narrowed my choices to these: Mastering Perl By brian d foy Perl Best Practices B

Re: How to know no. of times the script has been executed?

2009-01-08 Thread Mike Ward
sanket vaidya wrote: > > Hi all, > > I want to do something like this. > > Invoke a cmd (using system command) print a welcome message & execute the > remaining part of script. > > Now what I want is > 1. cmd should only be invoked with welcome message if the script is > executed first tim

Re: Neater way to declare variables

2009-01-08 Thread Ron Bergin
On Jan 8, 3:56 am, andrew.tayl...@hmrcaspire.com (Andrew Taylor) wrote: > Hello > > I have a script that is (at one point) reading through a file.  The file > is processed line by line and each line split into an array like so: > > while (<$TESTFILE>) > > { > >   my $cur_line=$_; > >   chomp ($cur_

Re: RegExp Searching - part deux

2009-01-08 Thread Paul M
That was easier: #!/usr/bin/perl use strict; use warnings; #my $line = "1elem21elema2a 1 bad13elema2eone 1 bad 1elemb2bone 2 bad1elemc2c13elemc2btwo13elemb2etwo13elem2"; my $line = "a < bade1 < bad b1 > badcb2e2"; my $cnt = 0; my @insides = $line =~ m{ (.*?)<\/elem1> }gmsx; for my $inside (

RegExp Searching - part deux

2009-01-08 Thread Paul M
What happens if I have a simple string: my $line = "1elem21elema2a 1 bad13elema2 1 bad elemb2 bad 2 z 1elemc2c13elemc2b13elemb2e13elem2"; That must follow simply rules: Find every alpha character string between the numbers one and two. The string may not include the number one two or three. SO

Re: Send email using smtp

2009-01-08 Thread Jenda Krynicky
From: Gunnar Hjalmarsson > Steve Bertrand wrote: > > Fúlvio Figueirôa wrote: > >> I solved my problem using sendmail with the code below: > >> > >> open (MAIL, "|/usr/sbin/sendmail -t "); > >> print MAIL "From: someaddr...@somedomain\n"; > >> print MAIL "To: someaddre...@somedomain\n"; > >> print

Re: Neater way to declare variables

2009-01-08 Thread Jenda Krynicky
From: "Taylor, Andrew \(ASPIRE\)" > I have a script that is (at one point) reading through a file. The file > is processed line by line and each line split into an array like so: > > while (<$TESTFILE>) > { > my $cur_line=$_; > chomp ($cur_line); while (defined(my $cur_line = <$TESTFILE>))

Re: Neater way to declare variables

2009-01-08 Thread Telemachus
On Thu Jan 08 2009 @ 11:56, Taylor, Andrew (ASPIRE) wrote: > # In a number of places, I have code that looks like the following. > > > > my $default_type; > > > > if( $split_line[0] eq "DEFAULT_INPUT" ) > > { > > $default_type = "INPUT"; > > } > This works OK, but I'm tryin

Re: Neater way to declare variables

2009-01-08 Thread Mr. Shawn H. Corey
On Thu, 2009-01-08 at 11:56 +, Taylor, Andrew (ASPIRE) wrote: > This works OK, but I'm trying to avoid declaring variables seperately > from assigning them (wherever possible), and trying to keep the size > of > the script down without losing human legibility. > > Is there a neater/cleverer

Neater way to declare variables

2009-01-08 Thread Taylor, Andrew (ASPIRE)
Hello I have a script that is (at one point) reading through a file. The file is processed line by line and each line split into an array like so: while (<$TESTFILE>) { my $cur_line=$_; chomp ($cur_line); my @split_line = split( /$t_delim/, $cur_line ); # In a numbe

Re: make command throws error "Perl script no found" C:/Program No such file or directory

2009-01-08 Thread Owen
> On Jan 6, 5:32 pm, rc...@pcug.org.au (Owen) wrote: >> > Hi, >> >> > I have perl5.10.0 installed under C:/ and using bash prompt to run >> a >> >makecommand. >> >> How are you doing that? >> >> >> >> > When I issue themakecommandit throws error >> >> > "Perl Script not found" C:/Program no such fi

Re: make command throws error "Perl script no found" C:/Program No such file or directory

2009-01-08 Thread viji19812001
On Jan 6, 5:32 pm, rc...@pcug.org.au (Owen) wrote: > > Hi, > > > I have perl5.10.0 installed under C:/ and using bash prompt to run a > >makecommand. > > How are you doing that? > > > > > When I issue themakecommandit throws error > > > "Perl Script not found" C:/Program no such file or directory >