RE: MOVE ON ALREADY!!!

2006-07-12 Thread Jeff Peng
Please. This thread has gone on long enough. What started out as a question with mixed responses (admittedly, I think mine may have been off the mark), has turned into a waste of my drive space. So with respect to those of us that have seen enough MOVE ON ALREADY!!! Don't say that please

Re: Randal L. Schwartz is Wrong

2006-07-12 Thread Chad Perrin
On Thu, Jul 13, 2006 at 02:04:15AM -0400, Mr. Shawn H. Corey wrote: > Omega -1911 wrote: > > > > So I ask, can someone up front stop the car, stop the arguing, simply > > pull over, ask for some directions and lead us to where ever it is we > > are supposedly going...As I forgot the map, starting

Re: MOVE ON ALREADY!!!

2006-07-12 Thread Mr. Shawn H. Corey
Mathew Snyder wrote: > Please. This thread has gone on long enough. What started out as a > question with mixed responses (admittedly, I think mine may have been > off the mark), has turned into a waste of my drive space. So with > respect to those of us that have seen enough > > MOVE ON ALREAD

Re: Randal L. Schwartz is Wrong

2006-07-12 Thread Mr. Shawn H. Corey
Omega -1911 wrote: > Am I allowed to give a view point from the perspective of a "newbie" > NOT to Perl, but to some of the "styles" I have been introduced to > (Remember TIMTOWTDI ???) > > What has taken place here is a "War of the Gods" that reminds me of so > many listservs, forums, and "magazi

Re: Randla L. Schwartz is Wrong (WAS:write out filenames of files existing on a filesystem into afile)

2006-07-12 Thread Chad Perrin
On Thu, Jul 13, 2006 at 01:16:37AM -0400, Omega -1911 wrote: > > So I ask, can someone up front stop the car, stop the arguing, simply > pull over, ask for some directions and lead us to where ever it is we > are supposedly going...As I forgot the map, starting to feel car-sick, > and I gotta peee

Re: Randal L. Schwartz is Wrong (WAS:write out filenames of files existing on a filesystem into afile)

2006-07-12 Thread Chad Perrin
On Thu, Jul 13, 2006 at 01:44:40AM -0400, Mr. Shawn H. Corey wrote: > > It comes down to this, either he will post an apology for stating a > third party should not post his comments, or I'll leave this list, never > to return. 1. You may have been able to garner some sympathy if you hadn't used

MOVE ON ALREADY!!!

2006-07-12 Thread Mathew Snyder
Please. This thread has gone on long enough. What started out as a question with mixed responses (admittedly, I think mine may have been off the mark), has turned into a waste of my drive space. So with respect to those of us that have seen enough MOVE ON ALREADY!!! Mathew Snyder Mr. Shawn H.

Re: regex repetition

2006-07-12 Thread Dr.Ruud
"Mumia W." schreef: > Ryan Moszynski: >> I need to write some code to allow users to specify which of a whole >> bunch of elements(e.g.512/1024) that they want to view. My idea for >> how to do this was to have them input a semicolon delimited list, for >> example: >> >> 1-10;25;33;100-250 >> >>

Re: Randal L. Schwartz is Wrong (WAS:write out filenames of files existing on a filesystem into afile)

2006-07-12 Thread Mr. Shawn H. Corey
Jeff Peng wrote: > Shawn is always kind to reply all kinds of questions here with > high-level skills.I think both you are great to people in the perl > world.So don't be angry for something that's not so important > please.This's a technology lists,too much topics about personal feeling > shoud ge

Re: Randla L. Schwartz is Wrong (WAS:write out filenames of files existing on a filesystem into afile)

2006-07-12 Thread Omega -1911
On 7/13/06, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: I thought about this; then I thought about this; and then I thought about this. Randal L. Schwartz wrote: >>"Shawn" == "Mr Shawn H Corey" <[EMAIL PROTECTED]> writes: > > > Shawn> Not everyone who reads this mailing list posts to it.

Re: Randla L. Schwartz is Wrong (WAS:write out filenames of files existing on a filesystem into afile)

2006-07-12 Thread Jeff Peng
Randla L. Schwartz is great on Perl field,I think everyone here has read some of his books.Those books bring us into Perl world and let us know what's the essence of Perl.I think he just want to let every answer here know the basic rules for asking/answering the questions.Follow the suggestions

Re: Randla L. Schwartz is Wrong (WAS:write out filenames of files existing on a filesystem into afile)

2006-07-12 Thread Mr. Shawn H. Corey
I thought about this; then I thought about this; and then I thought about this. Randal L. Schwartz wrote: >>"Shawn" == "Mr Shawn H Corey" <[EMAIL PROTECTED]> writes: > > > Shawn> Not everyone who reads this mailing list posts to it. What impression > Shawn> would his comments leave on them

Re: Check whether a string exists

2006-07-12 Thread Prabu Ayyappan
Hello , Hope this helps you. open(FILE2,"+; @found = grep(/server_lib\.files/,@text); $arsize=$#found+1; if($arsize>0) { print "seen server_lib.files"; } else { print "not seen server_lib.files"; my $header = "[server_lib.files]"; print FILE2 "\n"; print FILE2 $header; print FILE2 "\n"; } On 7

Re: Printing after expression match

2006-07-12 Thread John W. Krahn
Jim wrote: > I can't believe I didn't find this through searching. > While looping through a file,array,hash etc.. how can I start printing only > after a certain expression matches. in other words how can I skip the lines > in the data until an expression match. > Thanks > > -- > > # want to pri

Re: regex repetition

2006-07-12 Thread Mumia W.
On 07/12/2006 05:08 PM, Ryan Moszynski wrote: I need to write some code to allow users to specify which of a whole bunch of elements(e.g.512/1024) that they want to view. My idea for how to do this was to have them input a semicolon delimited list, for example: 1-10;25;33;100-250 i tried usin

RE: Printing after expression match

2006-07-12 Thread Jim
> > > Try: > > #!/usr/bin/perl > > use strict; > use warnings; > > my $print_line = 0; > > while( ){ > if( /banana/ ){ > $print_line = 1; > }elsif( $print_line ){ > print; > } > } > > __DATA__ > orange > peach > banana > apple > pear > mango > > > -- Thanks, this is simila

RE: Printing after expression match

2006-07-12 Thread Jim
> > > > ># want to print lines from apple on down > > > >while ($line = ) { > > next until $line =~ /^banan/; > > print $line; > >} > > > > Hello,how about this? > > my $ok; > while (){ > $ok = 1 if /^banan/; > print if $ok; > } > yes that works, thanks. Are there oth

Re: Printing after expression match

2006-07-12 Thread Mr. Shawn H. Corey
Jim wrote: > I can't believe I didn't find this through searching. > While looping through a file,array,hash etc.. how can I start printing only > after a certain expression matches. in other words how can I skip the lines > in the data until an expression match. > Thanks > > -- > > # want to pri

RE: Printing after expression match

2006-07-12 Thread Jeff Peng
# want to print lines from apple on down while ($line = ) { next until $line =~ /^banan/; print $line; } Hello,how about this? my $ok; while (){ $ok = 1 if /^banan/; print if $ok; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-ma

Printing after expression match

2006-07-12 Thread Jim
I can't believe I didn't find this through searching. While looping through a file,array,hash etc.. how can I start printing only after a certain expression matches. in other words how can I skip the lines in the data until an expression match. Thanks -- # want to print lines from apple on down

Re: Check whether a string exists

2006-07-12 Thread Nishi Bhonsle
Hi: I tried the following -- open(FILE2,">>c:/writeto.txt"); my @text = ; foreach my $a(@text) { print(@text); if ($a !~ /server_lib\.files/) { print "not seen server_lib.files"; my $header = "[server_lib.files]"; print FILE2 "\n"; print FILE2 $header; print FILE2 "\n"; } else {

Re: Check whether a string exists

2006-07-12 Thread Chasecreek Systemhouse
On 7/12/06, Nishi Bhonsle <[EMAIL PROTECTED]> wrote: Hi: I would like to check whether the string [server_bin.files] exists in a particular file and if it does, then do not add it again. How can I check for this string using perl regex? Perl Faq 4 print "seen server_bin.files" if /server_bin\

Check whether a string exists

2006-07-12 Thread Nishi Bhonsle
Hi: I would like to check whether the string [server_bin.files] exists in a particular file and if it does, then do not add it again. How can I check for this string using perl regex? Thanks!

Re: write out filenames of files existing on a filesystem into afile

2006-07-12 Thread Mr. Shawn H. Corey
Jay Savage wrote: > opendir(DIR, $somedir) or die "$!\n"; > my @files = grep { $_ !~ /^\.{1,2}$/ && -f "$somedir/$_" } readdir(DIR); > closedir(DIR); my @files = grep { -f } glob( "$somedir/*" ); If you're not interested in subdirectories, you only need glob(). And yes, it doesn't list hidd

Re: write out filenames of files existing on a filesystem into afile

2006-07-12 Thread Jay Savage
On 7/12/06, Nishi Bhonsle <[EMAIL PROTECTED]> wrote: Hi: Sorry to start this thread again, but it would not have been wise to ask my related question in a different thread. I tried to run the program on a windows machine, apparently the regex in question only lists directories within directories

Re: regex repetition

2006-07-12 Thread Aaron Priven
Check out the module Set::IntSpan and see if it does what you want. http://search.cpan.org/dist/Set-IntSpan/IntSpan.pm On Jul 12, 2006, at 3:08 PM, Ryan Moszynski wrote: I need to write some code to allow users to specify which of a whole bunch of elements(e.g.512/1024) that they want to view.

Re: regex repetition

2006-07-12 Thread Dr.Ruud
"Ryan Moszynski" schreef: > 1-10;25;33;100-250 echo '1-10;25;33;100-250' | perl -nle ' /\A\d+(?:-\d+)?(?:;\d+(?:-\d+)?)*\z/ and print "$_ =OK" ' But that also matches '12-3'. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-

Re: write out filenames of files existing on a filesystem into afile

2006-07-12 Thread Rob Dixon
Rob Dixon wrote: > > I think somebody mentioned it before, but what you need is File::Find. > This code > will put into @new the names of all the files in and below $path. > > use strict; > use warnings; > > use File::Find; > > my @new; > > find(sub {push @new, $File::Find::name}, $path)

Re: write out filenames of files existing on a filesystem into afile

2006-07-12 Thread Rob Dixon
Nishi Bhonsle wrote: > > Hi: > Sorry to start this thread again, but it would not have been wise to ask my > related question in a different thread. > I tried to run the program on a windows machine, apparently the regex in > question only lists directories within directories and not the files wit

Re: regex repetition

2006-07-12 Thread John W. Krahn
Ryan Moszynski wrote: > I need to write some code to allow users to specify which of a whole > bunch of elements(e.g.512/1024) that they want to view. My idea for > how to do this was to have them input a semicolon delimited list, for > example: > > 1-10;25;33;100-250 > > > i tried using this t

Re: regex repetition

2006-07-12 Thread Rob Dixon
Ryan Moszynski wrote: > > I need to write some code to allow users to specify which of a whole > bunch of elements(e.g.512/1024) that they want to view. My idea for > how to do this was to have them input a semicolon delimited list, for > example: > > 1-10;25;33;100-250 > > > i tried using this t

Re: write out filenames of files existing on a filesystem into afile

2006-07-12 Thread Nishi Bhonsle
Hi: Sorry to start this thread again, but it would not have been wise to ask my related question in a different thread. I tried to run the program on a windows machine, apparently the regex in question only lists directories within directories and not the files within the directories. I tried Rob'

RE: regex repetition

2006-07-12 Thread Timothy Johnson
Why not just use split()? Then you can do a simple regex on each element: ### use strict; use warnings; my $string = '1-10;25;33;1-00-250'; my @array = split(/;/,$string); foreach my $element(@array){ if($element =~ /^\d+-?\d*?$/){ print "$element => valid\n";

RE: question on redirecting output of Perl debugger commands

2006-07-12 Thread Gavin Bowlby
Tom, WC: Thanks! This works (almost) perfectly. I issued the open $DB::OUT, "| tee dbug.txt" as a Perl Debugger command. The output is a little funky when displaying Perl debugger keyboard commands entered by the user, but the output produced by the Perl debugger is captured faithfully in the

Re: regex repetition

2006-07-12 Thread Mr. Shawn H. Corey
Ryan Moszynski wrote: > I need to write some code to allow users to specify which of a whole > bunch of elements(e.g.512/1024) that they want to view. My idea for > how to do this was to have them input a semicolon delimited list, for > example: > > 1-10;25;33;100-250 You will need more than a r

regex repetition

2006-07-12 Thread Ryan Moszynski
I need to write some code to allow users to specify which of a whole bunch of elements(e.g.512/1024) that they want to view. My idea for how to do this was to have them input a semicolon delimited list, for example: 1-10;25;33;100-250 i tried using this to check to make sure they input a valid

Re: question on redirecting output of Perl debugger commands

2006-07-12 Thread Tom Phoenix
On 7/12/06, Gavin Bowlby <[EMAIL PROTECTED]> wrote: I would like to see the results of the Perl debugging session in a file. The debugger wasn't made with that in mind, but you could work around it. At least, this works for me. open $DB::OUT, "| tee dbug.txt" or die if $DB::OUT; You may fin

Re: calling a perl script on windows

2006-07-12 Thread Dr.Ruud
Mahdi A Sbeih schreef: > How can I make it to run exactly like Unix, meaning, just use the > first line in the script? Also check ASSOC and FTYPE. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Date Time

2006-07-12 Thread Timothy Johnson
It looks like part of your message got munged by one of our mail clients, but here's a code snippet that should give you an idea of how you can proceed: ## use strict; use warnings; $| = 1; my $string = '200607081000@@01510'; #Check to make sure the regex matched, then proceed.

Re: question on redirecting output of Perl debugger commands

2006-07-12 Thread Chasecreek Systemhouse
On 7/12/06, Gavin Bowlby <[EMAIL PROTECTED]> wrote: bash-2.05b$ cat test.pl #!/usr/bin/perl $x = 1; print "x:$x\n"; bash-2.05b$ perl -d test.pl | tee xxx 2>&1 > yyy Hmmm. You know, when posted previously I guess I should have stated that I had not yet gotten it to work myself but posted any

Re: Date Time

2006-07-12 Thread John W. Krahn
Semiyi.Abiola wrote: > Hi, Hello, > I got a file with this line: > > > 200607081000@@01510 > > It means Datetime@@Values > > I'm trying to insert this in Mysql with fields terminated by `@@`'; > > It's works fine but i got the wrong Datetime. > How kann i change 200607081000

RE: question on redirecting output of Perl debugger commands

2006-07-12 Thread Gavin Bowlby
WC: Thanks for your response! I think what you suggested works fine for normal shell commands, but it doesn't appear to work for the Perl debugger. Here's a sample session, running on a Linux machine: bash-2.05b$ cat test.pl #!/usr/bin/perl $x = 1; print "x:$x\n"; bash-2.05b$ perl -d test

Date Time

2006-07-12 Thread Semiyi.Abiola
Hi, I got a file with this line: 200607081000@@01510 It means Datetime@@Values I'm trying to insert this in Mysql with fields terminated by `@@`'; It's works fine but i got the wrong Datetime. How kann i change 200607081000 into 2006-07-08 10:00

RE: calling a perl script on windows

2006-07-12 Thread Timothy Johnson
In addition to the suggestions that have already been given about associating the .pl file extension with perl.exe, I would heartily recommend that you install ActivePerl from http://www.activestate.com. It's free, and is the de facto standard for Windows Perl. There are other ones that work (Cygw

Re: Copying files in windows from one directory to the other

2006-07-12 Thread John W. Krahn
kilaru rajeev wrote: > Hi, Hello, > I got some files in $BNY_DOWNLOAD which is a directory in windows. Now i > have to identify most recent one in that file and > have to move it $BNY_DATA directory it is also a directory. To identify the > most recent file I used sort command and sorted it > by

RE: Copying files in windows from one directory to the other

2006-07-12 Thread Timothy Johnson
Probably the simplest way to do this would be to use the File::Copy module. It's about as straightforward as you can get. move($BNY_DOWNLOAD."\\".$filename,$BNY_DATA."\\".$filename) or die("Couldn't copy $filename to $BNY_DATA! $!\n"); -Original Message- From: kilaru rajeev [mailto:[EMA

Re: Copying files in windows from one directory to the other

2006-07-12 Thread Tom Phoenix
On 7/12/06, kilaru rajeev <[EMAIL PROTECTED]> wrote: Now I want to move this file from this $BNY_DOWNLOAD to $BNY_DATA directory. You may be able to simply use rename() to do what you want, but it sounds as if you might want to use the File::Copy module, and its move() function. Hope this help

Re: Script Optimization file parsing script

2006-07-12 Thread Dr.Ruud
"Nagrale, Ajay" schreef: > I am working on optimization of one of the file parsing script. There > are around 4,50,000 lines present in the input file. This file size > is bound to increase in coming days. New entries would be added every > 2 minutes. > > Current script is taking around 60 seconds

Copying files in windows from one directory to the other

2006-07-12 Thread kilaru rajeev
Hi, I got some files in $BNY_DOWNLOAD which is a directory in windows. Now i have to identify most recent one in that file and have to move it $BNY_DATA directory it is also a directory. To identify the most recent file I used sort command and sorted it by using -M and and space ship operators.

Re: Script Optimization file parsing script

2006-07-12 Thread Mr. Shawn H. Corey
Nagrale, Ajay wrote: > The flow in the script is something like this: > > 1. Open the input file handle using the open function > 2. In while loop parse the entries (using the file handle > directly in while), parse the input entries. Do the sanity > check required (sanity check involved is a combi

Re: Linux to Windows portability problem

2006-07-12 Thread Tom Phoenix
On 7/12/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Perl returns me an error message : "cannot use initialized value in null operation". I can't find that message in perldiag.pod, which should have all of perl's own diagnostic messages. I suspect that that message is coming from one of th

Script Optimization file parsing script

2006-07-12 Thread Nagrale, Ajay
Hi, I am working on optimization of one of the file parsing script. There are around 4,50,000 lines present in the input file. This file size is bound to increase in coming days. New entries would be added every 2 minutes. Current script is taking around 60 seconds (average) and 150 seconds (m

Re: Linux to Windows portability problem

2006-07-12 Thread Jay Savage
On 7/12/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hello, I have a quite common problem : portability :( I wrote a Perl script that works perfectly under Linux with Perl 5.8.8. Very confident, I try to run it under Windows with the lastest release of ActivePerl, and all required modules. B

RE: calling a perl script on windows

2006-07-12 Thread Sam DeForest
> -Original Message- > From: Mahdi A Sbeih [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 12, 2006 2:41 AM > To: beginners@perl.org > Subject: calling a perl script on windows > > Hi all, > > I am working on porting some scripts from unix to windows, and I noticed > that perl ignores t

RE: Specify download file name

2006-07-12 Thread Nagasamudram, Prasanna Kumar
Hi Anish The following example works and I have tested it. use CGI; $cgiObject=new CGI; $filename="SRQ.zip"; print $cgiObject->header(-charset=>'', -Expires=>'-1d' , -'Cache-Control'=>'private, max-age=0',

Linux to Windows portability problem

2006-07-12 Thread mickb
Hello, I have a quite common problem : portability :( I wrote a Perl script that works perfectly under Linux with Perl 5.8.8. Very confident, I try to run it under Windows with the lastest release of ActivePerl, and all required modules. But annoyances come quickly :( Perl returns me an error mess

Re: calling a perl script on windows

2006-07-12 Thread Beginner
On 12 Jul 2006 at 0:32, Mahdi A Sbeih wrote: > Hi Chandru, > > Do I need to go to windows_explorer->Tools->Folder Options->File Types > and associating the extension ".pl" with the "perl" executable? Yes. However if you've installed activestate's Perl it would have asked if you wanted to do th

Re: calling a perl script on windows

2006-07-12 Thread Rob Dixon
Chandru wrote: Mahdi A Sbeih wrote: Hi all, I am working on porting some scripts from unix to windows, and I noticed that perl ignores the first line of the script, and it seems I have to run the script like this: D:\Perl\bin\perl.exe myscript.pl if I run it like we do on unix: ./myscript.

Re: calling a perl script on windows

2006-07-12 Thread Mahdi A Sbeih
Hi Chandru, Do I need to go to windows_explorer->Tools->Folder Options->File Types and associating the extension ".pl" with the "perl" executable? What if the perl is in the D: drive not C:, also do I need to specify ".exe" Thanks, Mahdi. Chandru wrote: Mahdi A Sbeih wrote: Hi all, I

Re: calling a perl script on windows

2006-07-12 Thread Rob Dixon
> Hi all, Hello Mahdi. > I am working on porting some scripts from unix to windows, and I noticed that > perl ignores the first line of the script, and it seems I have to run the > script like this: > > D:\Perl\bin\perl.exe myscript.pl > > if I run it like we do on unix: > ./myscript.pl > > it w

Re: pattern match

2006-07-12 Thread Rob Dixon
Ryan Dillinger wrote: > > Hello, Hi Ryan > I had two scripts that were identical, well almost. I ran the two together, > but straghtened them out. Anyway I have one here, that when ran say's: Use of > uninitialized value in pattern match (m//) at headline.pl line 7 and 10. I > have changed dif

Re: calling a perl script on windows

2006-07-12 Thread Chandru
Mahdi A Sbeih wrote: Hi all, I am working on porting some scripts from unix to windows, and I noticed that perl ignores the first line of the script, and it seems I have to run the script like this: D:\Perl\bin\perl.exe myscript.pl if I run it like we do on unix: ./myscript.pl it will searc