Re: including . in a pattern match

2006-01-30 Thread Keith Worthington
On Fri, 27 Jan 2006 18:31:18 -0500, Chas Owens wrote Another thing you can do is break your larger regexes into parts to make them more readable/maintainable. It also helps to use the x flag so that you can separate the individual tokens and comment them. #!/usr/bin/perl use strict; use

Re: including . in a pattern match

2006-01-30 Thread Keith Worthington
On Mon, 30 Jan 2006 10:26:51 -0500, Chas Owens wrote On 1/30/06, Keith Worthington [EMAIL PROTECTED] wrote: snip Wow, it is going to take me some time to wrap my head around this code. I really like the commenting idea. That certainly will help the next time around. I don't get

Re: including . in a pattern match

2006-01-30 Thread Keith Worthington
On Mon, 30 Jan 2006 10:26:51 -0500, Chas Owens wrote On 1/30/06, Keith Worthington [EMAIL PROTECTED] wrote: snip Wow, it is going to take me some time to wrap my head around this code. I really like the commenting idea. That certainly will help the next time around. I don't get

Re: including . in a pattern match

2006-01-30 Thread Keith Worthington
snip The only challenge is that the $p_number pattern seems to match all of the following. 10 1/2 10-1/2 10--1/2 I started out with (\s+|-?) as my delimiter pattern and then when that didn't work I changed it to (\s+|-{1,1}). It still matches the case with two hyphens. Can you tell me

Re: including . in a pattern match

2006-01-30 Thread Keith Worthington
On Mon, 30 Jan 2006 13:26:42 -0500, Chas Owens wrote On 1/30/06, Keith Worthington [EMAIL PROTECTED] wrote: snip Well, the answer was right in fromt of me. The delimiter pattern is matching the first hyphen and the integer pattern is matching the second hyphen as a negative sign

including . in a pattern match

2006-01-27 Thread Keith Worthington
Hi All, I am still a newbie in Perl and it is only with the help of this list that I was able to construct the following pattern match. ($v_size_str =~ /\d+\s*[']\s*x\s*\d+\s*[']/i) The problem that I have just realized that this string will match the first line of this input file but not

Re: perl newbie question

2005-07-25 Thread Keith Worthington
hi , I am a perl newbie. Can someone suggest a perl command line snippet that will print the last n lines of a file. thanks in advance. regards, Kaushik Kaushik, If you are on the command line I suggest the use of the tail command. tail -n 123 filename If you must perform this

Re: need help please

2005-04-24 Thread Keith Worthington
[EMAIL PROTECTED] wrote: Hi My program is to send data using an online form. I have the web page for the form. But the web page does not receive the data from the cgi file. I check my work in DOS. When I type perl -c bonus.cgi I get a message tell me syntax ok. But when I check with :

Re: Need help match feet and inches

2005-04-21 Thread Keith Worthington
On Wed, 20 Apr 2005 15:19:28 -0700, John W. Krahn wrote Keith Worthington wrote: Hi All, Hello, Here is my code so far. I am really getting frustrated with my inability to get this right. I didn't understand Chris' earlier suggestion about using defined but I tried using

More help with split

2005-04-20 Thread Keith Worthington
Hi All, I continue to work on my first perl program. :-) I am stuck again and could use your guidance. Here is the code snippet that I am working on right now. The problem that I have is that when processing a size like 30 x 150'6 it sees the first dimension as a number of feet. How can I get

default value from match

2005-04-20 Thread Keith Worthington
Hi All, I am still slugging it out. Many thanks to those that have helped me thus far. :-) Having written the following code I am now troubled by v_feet_str or v_inch_str being undefined. If there is no match can I return a default value? In my case if there is no dimension then I want to

Need help match feet and inches

2005-04-20 Thread Keith Worthington
Hi All, Here is my code so far. I am really getting frustrated with my inability to get this right. I didn't understand Chris' earlier suggestion about using defined but I tried using it anyway. I cannot seem to get the pattern match to properly handle a dimension that is just feet or just

Re: Need help match feet and inches

2005-04-20 Thread Keith Worthington
On Wed, 20 Apr 2005 15:34:37 -0400, Paul Kraus wrote Hello, Please stop making new threads for the same topic. Reply to the same thread. Keeps the group organized as well as our inboxes and archive searches. If someone else who had a simliar issue and did a google search they could click one

Help with split Was Need RE. New to Perl

2005-04-19 Thread Keith Worthington
Hi All, Many thanks to Jay for his examples I have now written a perl script that is munging a text file. Eventually I will move the perl code into a function inside a postgresql database. I am processing inputs like the following: 815 HTPP Black 2in sq Border: RMFP025BK Size: 7'10 x 16' Tag:

Re: Help with split Was Need RE. New to Perl

2005-04-19 Thread Keith Worthington
On Tue, 19 Apr 2005 10:23:00 -0400, Jay Savage wrote On 4/19/05, Keith Worthington [EMAIL PROTECTED] wrote: Hi All, Many thanks to Jay for his examples I have now written a perl script that is munging a text file. Eventually I will move the perl code into a function inside

Re: Help with split Was Need RE. New to Perl

2005-04-19 Thread Keith Worthington
On Tue, 19 Apr 2005 13:19:31 -0400, Jay Savage wrote On 4/19/05, Keith Worthington [EMAIL PROTECTED] wrote: On Tue, 19 Apr 2005 10:23:00 -0400, Jay Savage wrote On 4/19/05, Keith Worthington [EMAIL PROTECTED] wrote: Hi All, Many thanks to Jay for his examples I have now written

Need RE. New to Perl

2005-04-18 Thread Keith Worthington
Hi All, I am new to the list and need some quick help. I have been kicking around with vi and sed for years but never took the time to learn Perl. Now I need to use Perl and could really use a jumpstart. I am writing a function in the Postgresql database using Perl because of its text

Re: Need RE. New to Perl

2005-04-18 Thread Keith Worthington
On Mon, 18 Apr 2005 15:30:39 -0400, Jay Savage wrote On 4/18/05, Keith Worthington [EMAIL PROTECTED] wrote: Hi All, I am new to the list and need some quick help. I have been kicking around with vi and sed for years but never took the time to learn Perl. Now I need to use Perl