Re: Need help with a programming problem

2013-10-05 Thread Rob Dixon
On 04 Oct 2013 06:33, Shlomi Fish wrote: On 02 Oct 2013 Uri Guttman wrote: On 02 Oct 2013 08:56 PM, Rob Dixon wrote: On 03 Oct 2013 01:39, Uri Guttman wrote: I do recommend you try to use File::Slurp to read in and write out your files. It would help a lot if you declared your interest in

Re: Need help with a programming problem

2013-10-05 Thread Uri Guttman
On 10/05/2013 04:54 AM, Rob Dixon wrote: Uri, I rarely see File::Slurp recommended other than by yourself. usually it is in the context of a work-around for Perl's lack of support for a regex version of $/. I have also never had occasion to use it myself, despite a working understanding of its

Re: Need help with a programming problem

2013-10-05 Thread John SJ Anderson
Please take any further messages in this conversation off list. It's off-topic, off-putting to newcomers, and generally boring and/or aggravating for those of us that have seen it before. Rob: there is no obligation for people to disclose that they wrote the stuff they're advocating. Nobody has a

Re: Need help with a programming problem

2013-10-03 Thread Charles DeRykus
On Wed, Oct 2, 2013 at 5:10 PM, Peter Holsberg pjh42atpobox@gmail.comwrote: Charles DeRykus has written on 10/2/2013 5:49 PM: Wouldn't a manual edit be easier... or is this a recurrent problem? If recurrent, a messy solution may be possible but fragile unless the html formatting is

Re: Need help with a programming problem

2013-10-03 Thread Shlomi Fish
Hi Uri, On Wed, 02 Oct 2013 23:44:04 -0400 Uri Guttman u...@stemsystems.com wrote: On 10/02/2013 08:56 PM, Rob Dixon wrote: On 03/10/2013 01:39, Uri Guttman wrote: I do recommend you try to use File::Slurp to read in and write out your files. It would help a lot if you declared your

Need help with a programming problem

2013-10-02 Thread Peter Holsberg
Hi, I have tried to do this for hours but it looks like it is just too difficult for me. I would like a script to open a file in the current directory and edit it. The file's name is \d{6}.htm The script then needs to search for a line that begins: a class=nolinkunderline and delete that line

Re: Need help with a programming problem

2013-10-02 Thread John SJ Anderson
On Wed, Oct 2, 2013 at 10:22 AM, Peter Holsberg pjh42atpobox@gmail.com wrote: Hi, I have tried to do this for hours but it looks like it is just too difficult for me. You should maybe show the code you have, and we can help you with that. If you've worked for hours, you must have

Re: Need help with a programming problem

2013-10-02 Thread Peter Holsberg
John SJ Anderson has written on 10/2/2013 1:45 PM: On Wed, Oct 2, 2013 at 10:22 AM, Peter Holsberg pjh42atpobox@gmail.com wrote: Hi, I have tried to do this for hours but it looks like it is just too difficult for me. You should maybe show the code you have, and we can help you with

Re: Need help with a programming problem

2013-10-02 Thread Shawn H Corey
On Wed, 02 Oct 2013 13:57:36 -0400 Peter Holsberg pjh42atpobox@gmail.com wrote: blushing I was so upset that I deleted it all! It seems to me that it should be fairly straightforward, but at 79, the old synapses aren't firing quite as well as they used to. Can you get me started? Sure:

Re: Need help with a programming problem

2013-10-02 Thread Peter Holsberg
Shawn H Corey has written on 10/2/2013 2:29 PM: On Wed, 02 Oct 2013 13:57:36 -0400 Peter Holsberg pjh42atpobox@gmail.com wrote: blushing I was so upset that I deleted it all! It seems to me that it should be fairly straightforward, but at 79, the old synapses aren't firing quite as well

Re: Need help with a programming problem

2013-10-02 Thread Jim Gibson
On Oct 2, 2013, at 10:22 AM, Peter Holsberg wrote: Hi, I have tried to do this for hours but it looks like it is just too difficult for me. I would like a script to open a file in the current directory and edit it. The file's name is \d{6}.htm That is an unusual name for a file. I

Re: Need help with a programming problem

2013-10-02 Thread Shawn H Corey
On Wed, 02 Oct 2013 15:44:56 -0400 Peter Holsberg pjh42atpobox@gmail.com wrote: Why are you globbing *.htm? See `perldoc -f glob` and `perldoc File::Glob`. -- Don't stop where the ink does. Shawn -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands,

Re: Need help with a programming problem

2013-10-02 Thread Rob Dixon
On 02/10/2013 20:44, Peter Holsberg wrote: Shawn H Corey has written on 10/2/2013 2:29 PM: my @files = grep { /^\d{6}\.htm$/i } glob( '*.htm' ); Well, I'm more of a beginner than I thought I was! The /i to grep is to ignore case? Why are you globbing *.htm? Hi Peter All that Shawn has

Re: Need help with a programming problem

2013-10-02 Thread Brian Fraser
On Wed, Oct 2, 2013 at 4:44 PM, Peter Holsberg pjh42atpobox@gmail.comwrote: Shawn H Corey has written on 10/2/2013 2:29 PM: On Wed, 02 Oct 2013 13:57:36 -0400 Peter Holsberg pjh42atpobox@gmail.com wrote: blushing I was so upset that I deleted it all! It seems to me that it

Re: Need help with a programming problem

2013-10-02 Thread Shawn H Corey
On Wed, 02 Oct 2013 23:43:40 +0100 Rob Dixon rob.di...@gmx.com wrote: The file's name is \d{6}.htm do you mean that literal name, or do you want to include *.htm files that start with six decimal digits? Jim Gibson has assumed the former, while Shawn, the latter. It would be difficult

Re: Need help with a programming problem

2013-10-02 Thread Brian Fraser
On Wed, Oct 2, 2013 at 8:19 PM, Shawn H Corey shawnhco...@gmail.com wrote: On Wed, 02 Oct 2013 23:43:40 +0100 Rob Dixon rob.di...@gmx.com wrote: The file's name is \d{6}.htm do you mean that literal name, or do you want to include *.htm files that start with six decimal digits? Jim

Re: Need help with a programming problem

2013-10-02 Thread Peter Holsberg
sigh Let me start over. The file I want to modify has a 6-digit filename and an extension htm. For example, 131002.htm I'm working in Windows, with Strawberry perl, with Randall L. Schwartz's Learning Perl, copyright 1993. I also have Perl 5 Pocket Reference, 1998 and copies of Programming Perl

Re: Need help with a programming problem

2013-10-02 Thread Uri Guttman
On 10/02/2013 07:19 PM, Shawn H Corey wrote: On Wed, 02 Oct 2013 23:43:40 +0100 Rob Dixon rob.di...@gmx.com wrote: The file's name is \d{6}.htm do you mean that literal name, or do you want to include *.htm files that start with six decimal digits? Jim Gibson has assumed the former, while

Re: Need help with a programming problem

2013-10-02 Thread Uri Guttman
On 10/02/2013 08:02 PM, Peter Holsberg wrote: sigh Let me start over. The file I want to modify has a 6-digit filename and an extension htm. For example, 131002.htm i figured that was the case. you should state that in the beginning and then say a regex to match that is \d{6}\.htm. then you

Re: Need help with a programming problem

2013-10-02 Thread Peter Holsberg
Uri Guttman has written on 10/2/2013 8:39 PM: On 10/02/2013 08:02 PM, Peter Holsberg wrote: sigh Let me start over. The file I want to modify has a 6-digit filename and an extension htm. For example, 131002.htm i figured that was the case. you should state that in the beginning and then

Re: Need help with a programming problem

2013-10-02 Thread Rob Dixon
On 03/10/2013 00:19, Shawn H Corey wrote: It would be difficult to get a file with a backslash in it. perl -e open X, q/\d{6}.htm/ Rob -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Need help with a programming problem

2013-10-02 Thread Rob Dixon
On 03/10/2013 01:39, Uri Guttman wrote: I do recommend you try to use File::Slurp to read in and write out your files. It would help a lot if you declared your interest in File::Slurp. It is disingenuous to recommend your own modules. Rob -- To unsubscribe, e-mail:

Re: Need help with a programming problem

2013-10-02 Thread Rob Dixon
On 02/10/2013 18:22, Peter Holsberg wrote: Hi, I have tried to do this for hours but it looks like it is just too difficult for me. I would like a script to open a file in the current directory and edit it. The file's name is \d{6}.htm The script then needs to search for a line that begins:

Re: Need help with a programming problem

2013-10-02 Thread Rob Dixon
That should read as follows: use strict; use warnings; use Tie::File; use File::Copy 'copy'; use File::Spec; my $dir = '/path/to/my/directory'; opendir my ($dh), $dir; # Find all files in the directory that match \d{6}\.htm # Die if none or multiple files found # my @files = grep

Re: Need help with a programming problem

2013-10-02 Thread Uri Guttman
On 10/02/2013 08:44 PM, Peter Holsberg wrote: Uri Guttman has written on 10/2/2013 8:39 PM: use File::Slurp qw( read_dir edit_file ) ; foreach my $file ( grep /^\d{6}\.htm$/, read_dir( $dir ) ) { edit_file { s/foo/bar/g } $file ; } read_dir is also

Re: Need help with a programming problem

2013-10-02 Thread Uri Guttman
On 10/02/2013 08:56 PM, Rob Dixon wrote: On 03/10/2013 01:39, Uri Guttman wrote: I do recommend you try to use File::Slurp to read in and write out your files. It would help a lot if you declared your interest in File::Slurp. It is disingenuous to recommend your own modules. i don't see

Re: Need help with a programming problem

2013-10-02 Thread John W. Krahn
Peter Holsberg wrote: sigh Let me start over. The file I want to modify has a 6-digit filename and an extension htm. For example, 131002.htm I'm working in Windows, with Strawberry perl, with Randall L. Schwartz's Randal L. Schwartz John -- Any intelligent fool can make things bigger and

Re: Need help with a programming problem

2013-10-02 Thread John W. Krahn
Shawn H Corey wrote: On Wed, 02 Oct 2013 13:57:36 -0400 Peter Holsbergpjh42atpobox@gmail.com wrote: blushing I was so upset that I deleted it all! It seems to me that it should be fairly straightforward, but at 79, the old synapses aren't firing quite as well as they used to. Can you