Re: Pattern matching question

2009-03-31 Thread John W. Krahn
Richard Hobson wrote: Hi, Hello, Please be patient with this beginner. I have a subrouting as follows, that prints out an ASCII representation of chess board sub display_board { foreach (0..7) { my $ref = @_[$_]; That should be: my $ref = $_[$_]; Or better: f

Re: Pattern matching question

2009-03-31 Thread Telemachus
On Tue Mar 31 2009 @ 3:32, Richard Hobson wrote: > It works, but is there a way of combining these lines: > > my $piece = $ref->[$_]; > $piece =~ /.*(..$)/; > > It feels like this could be done in one step. Is this correct? I'm > finding that I'm d

Re: Pattern matching question

2008-09-23 Thread Mr. Shawn H. Corey
On Tue, 2008-09-23 at 14:05 -0700, Darren Nay wrote: > Here is the string: > doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"; > doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" /> > > Now, I want to match against that string and retrieve the value of > doctype-sys

Re: pattern matching question

2008-09-23 Thread ANJAN PURKAYASTHA
hi all, the "column" is in a text file. fyi, david's pattern matching expression (/^[ATGC]+$/i) did the job perfectly. thanks all for you feedback! anjan On Tue, Sep 23, 2008 at 5:07 AM, sanket vaidya <[EMAIL PROTECTED]>wrote: > > > > Hi Anjan, >Not able to get where your "column" is. I a

RE: pattern matching question

2008-09-23 Thread sanket vaidya
Hi Anjan, Not able to get where your "column" is. I am Assuming your column is in Text file. However even if it is not in text file, then also this may provide you a fair hint about how to proceed further. use warnings; use strict; open FH,"example.txt" or die "Cannot open file: $!"; #(

Re: pattern matching question

2008-09-23 Thread Mr. Shawn H. Corey
On Mon, 2008-09-22 at 21:21 -0400, ANJAN PURKAYASTHA wrote: > here is my problem: > i have to check the entries of a column and write them out to a file if they > happen to be DNA sequences ie they are exclusively composed of the letters > A, T, G, C- no spaces or digits. > the column also happens

RE: pattern matching question

2008-09-23 Thread sanket vaidya
Hi Anjan, Not able to get what your "column" is. I am Assuming your column is in Text file. However even if it is not in text file, then this may provide you a fair hint about how to proceed further. use warnings; use strict; open FH,"example.txt" or die "Cannot open file: $!"; #(example.

RE: pattern matching question

2008-09-22 Thread Dave
-Original Message- From: ANJAN PURKAYASTHA [mailto:[EMAIL PROTECTED] Sent: Tuesday, 23 September 2008 11:22 AM To: beginners@perl.org Subject: pattern matching question here is my problem: i have to check the entries of a column and write them out to a file if they happen to be DNA sequen

Re: Pattern Matching Question

2005-11-28 Thread Jeff 'japhy' Pinyan
On Nov 27, Dax Mickelson said: I am having problems matching ALL possible matches of a string against another (very large) string. I am doing something like: @LargeArray = ($HugeString =~ m/$Head/ig); Where $Head is an 8 character string. (Basically I want to get all 16 character lon

Re: Pattern Matching Question

2005-11-28 Thread Dr.Ruud
Dr.Ruud: > #!/usr/bin/perl > use strict; use warnings; > > { local ($,, $\) = (':', "\n"); > > $_ = 'AASDFGHJKL'; > my $Head = ''; > > print $Head, $1, substr($',0,7) while /(?<=$Head)(.)(?=.{7})/ig; > } Revision: #!/usr/bin/perl use strict; use warnings;

Re: Pattern Matching Question

2005-11-28 Thread Dr.Ruud
Dax Mickelson schreef: > I am having problems matching ALL possible matches of a string against > another (very large) string. I am doing something like: @LargeArray > = ($HugeString =~ m/$Head/ig); Where $Head is an 8 character > string. (Basically I want to get all 16 character long

Re: Pattern Matching Question

2005-11-27 Thread John W. Krahn
Dax Mickelson wrote: > I am having problems matching ALL possible matches of a string against > another (very large) string. I am doing something like: @LargeArray = > ($HugeString =~ m/$Head/ig); Where $Head is an 8 character > string. (Basically I want to get all 16 character long sub

RE: Pattern Matching Question

2005-11-27 Thread S, karthik \(IE03x\)
Hope you are getting what you require.. If not, what you expect the result to be? With Best Regards, Karthikeyan S Honeywell Process Solutions - eRetail Honeywell Automation India Limited Phone:91-20-56039400 Extn -2701 Mobile :(0)9325118422 E-Mail: [EMAIL PROTECTED] This e-mail, and any

Re: pattern matching question - please help

2005-06-19 Thread MEENA SELVAM
Hi Chris, Thanks for your detailed email and for your time. I think my second email crossed your email. The book I read on Perl did not mention anything about first and second half, and that didnt explain, me that we were replacing all upsto last / by nothing. I thought it is replacing with / itsel

Re: pattern matching question - please help

2005-06-19 Thread Chris Devers
On Sun, 19 Jun 2005, MEENA SELVAM wrote: > can anyone please explain? See `perldoc perlre`, or `man perlre`, or a book like _Learning Perl_ or _Mastering Regular Expressions_ for this kind of thing. It's really an introductory question that any decent introductory text should be able to cover

Re: pattern matching question - please help

2005-06-19 Thread MEENA SELVAM
Hi , in $prog =~ s/^.*\///; is it trying to substitute all characters until the last / within $prog? meena --- MEENA SELVAM <[EMAIL PROTECTED]> wrote: > Hi, > > can anyone please explain? > > In the following code snippet, what is the meaning > of > the pattern match > s/^.*\/// > > $prog = $

Re: pattern matching question

2004-12-23 Thread Chris Devers
On Thu, 23 Dec 2004, John McCormick wrote: > i'm trying to figure out how to split a file delimited > by commas and newlines. > @data = split (/\n|\,/, ) > the only problem is that some of the data fields are > strings enclosed in double quotes, and within some of > those double quotes are more

Re: pattern matching question

2004-12-23 Thread Chris Charley
- Original Message - From: "John McCormick" i'm trying to figure out how to split a file delimited by commas and newlines. @data = split (/\n|\,/, ) the only problem is that some of the data fields are strings enclosed in double quotes, and within some of those double quotes are more com

Re: pattern matching question

2004-12-23 Thread Jonathan Paton
> i'm trying to figure out how to split a file delimited > by commas and newlines. Sounds like a CSV file to me, and for those you look on CPAN for a ready made solution. http://search.cpan.org/search?query=CSV&mode=module Jonathan Paton -- #!perl $J=' 'x25 ;for (qq< 1+10 9+14 5-10 50-9 7+13 2

RE: pattern matching question

2002-02-28 Thread Jason Larson
-Original Message- From: bob ackerman [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 28, 2002 11:32 AM To: richard noel fell Cc: [EMAIL PROTECTED] Subject: Re: pattern matching question On Thursday, February 28, 2002, at 08:37 AM, richard noel fell wrote: > while (defined($L

RE: pattern matching question

2002-02-28 Thread Jason Larson
-Original Message- From: richard noel fell [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 28, 2002 10:38 AM To: [EMAIL PROTECTED] Subject: pattern matching question I have the following bit of code: #!/usr/bin/perl -w open In2,"/home/rfell/tutoring/beaven/webproject/tmp/maxima_log" o

Re: pattern matching question

2002-02-28 Thread bob ackerman
On Thursday, February 28, 2002, at 08:37 AM, richard noel fell wrote: > while (defined($Line=)){ > if($Line=~/(\(D\d+\))\s*(\w*)/){ > print "==> $2\n"; > }; > }; > disclaimer: i am a rank newbot if i replace '/w*' with '.*$' i get desired text. looks like \w* doesn't do what we expect. probl