Re: Pattern matching problem - Why won't this work?

2010-04-13 Thread Shawn H Corey
Owen Chavez wrote: Hello! I have a pattern matching question using Perl 5.10, Windows 7. Suppose I have a file containing the following block of text: Hello there TODD I my We Us ourselves OUr I. The file has 10 words, including 7 first-person pronouns (and 3 non-pronouns that I have no inter

Re: Pattern matching problem - Why won't this work?

2010-04-13 Thread Peter Scott
On Mon, 12 Apr 2010 23:04:53 -0500, Owen Chavez wrote: > Can you suggest a reference on hashes that will provide some clue as to > how they can be used for the problem I posted? I've looked over > Programming Perl (3rd) and it's not entirely clear to me how to proceed > with a hash. Learning Perl

Re: Pattern matching problem - Why won't this work?

2010-04-12 Thread Owen Chavez
Thank you for the feedback. I do apologize for not posting a working example; I can't post the full code and I was attempting to extract the offending sections. I have no particular fondness for grep. A search of postings on perlmonks revealed a variation of the code I employed. I am learning p

Re: Pattern matching problem - Why won't this work?

2010-04-12 Thread Peter Scott
On Mon, 12 Apr 2010 21:06:58 -0500, Owen Chavez wrote: > I have a pattern matching question using Perl 5.10, Windows 7. Suppose > I have a file containing the following block of text: > > Hello there TODD > I my We Us ourselves OUr I. > > The file has 10 words, including 7 first-person pronouns

Pattern matching problem - Why won't this work?

2010-04-12 Thread Owen Chavez
Hello! I have a pattern matching question using Perl 5.10, Windows 7. Suppose I have a file containing the following block of text: Hello there TODD I my We Us ourselves OUr I. The file has 10 words, including 7 first-person pronouns (and 3 non-pronouns that I have no interest in). I've scrabb

Re: Pattern matching problem

2008-02-29 Thread Gunnar Hjalmarsson
Anirban Adhikary wrote: Subject: Pattern matching problem As far as I can tell, this is not a pattern matching problem. I have a very large file basically it is logfile generated by sql loader. In the production environment this file can have one million/ two million data. In this

Pattern matching problem

2008-02-29 Thread Anirban Adhikary
Dear List I have a very large file basically it is logfile generated by sql loader. In the production environment this file can have one million/ two million data. In this file there are 4 particular lines which i need to extract from this log file. *Total logical records skipped:

Re: Pattern matching problem

2005-05-10 Thread John Doe
Am Dienstag, 10. Mai 2005 11.23 schrieb Kpramod: > Hi John, > Try to use 'chop' to get null value > Thanks and Regards > Pramod Hi Pramad, sorry, I don't understand what you mean. Do you refer to the line my @new=grep {$_ and !/^\s+$/ and !/^\0+$/} @array1; (I see that the test for \0 is ugly,

Re: Pattern matching problem

2005-05-10 Thread John Doe
Am Dienstag, 10. Mai 2005 11.46 schrieb Tielman Koekemoer (TNE): > >> $counter2 = 0; > > > >What's that for? (never used) > > Hmm yeah sorry that was supposed to be $counter = 0; > > >Use push() to avoid holding the current array index. > > What do you mean by "holding the index"? "remember (and i

RE: Pattern matching problem

2005-05-10 Thread Tielman Koekemoer \(TNE\)
Ah I see: use push() to add scalars/lists to arrays. Thanks everyone for the help. > Use push() to avoid holding the current array index. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Pattern matching problem

2005-05-10 Thread Tielman Koekemoer \(TNE\)
>> $counter2 = 0; >What's that for? (never used) Hmm yeah sorry that was supposed to be $counter = 0; >Use push() to avoid holding the current array index. What do you mean by "holding the index"? >my @array1=(' ', 'a', '', 'b', "\0", 'c', undef, 'd', ' ', 'e'); my @new=grep {$_ and !/^\s+$/

Re: Pattern matching problem

2005-05-10 Thread Kpramod
Hi John, Try to use 'chop' to get null value Thanks and Regards Pramod John Doe wrote: Am Dienstag, 10. Mai 2005 11.01 schrieb Tielman Koekemoer (TNE): Hi all, I have tried various regular expressions to remove null or empty values on array @array1 and create a new array @OPD01 with the values.

Re: Pattern matching problem

2005-05-10 Thread Ing. Branislav Gerzo
Tielman Koekemoer (TNE) [TK], on Tuesday, May 10, 2005 at 11:01 (+0200) contributed this to our collective wisdom: TK> I have tried various regular expressions to remove null or empty TK> values on array @array1 and create a new array @OPD01 with the values. TK> This, however, does not work as I s

Re: Pattern matching problem

2005-05-10 Thread John Doe
Am Dienstag, 10. Mai 2005 11.01 schrieb Tielman Koekemoer (TNE): > Hi all, > > I have tried various regular expressions to remove null or empty > values on array @array1 and create a new array @OPD01 with the values. > This, however, does not work as I still get a number of empty values > in the @O

Pattern matching problem

2005-05-10 Thread Tielman Koekemoer \(TNE\)
Hi all, I have tried various regular expressions to remove null or empty values on array @array1 and create a new array @OPD01 with the values. This, however, does not work as I still get a number of empty values in the @OPD01 array after this processing. As you'll see I tried various things - che

Re: Pattern matching problem

2004-02-26 Thread wolf blaum
On Thursday 26 February 2004 12:28, Henry Todd generously enriched virtual reality by making up this one: > On 2004-02-26 00:43:21 +, [EMAIL PROTECTED] (Wolf Blaum) said: > > As I understand Biology, there is 4 nucleotid acids which gives 4**2 > > combinaions for dupplets. So you need 8 vars

Re: Pattern matching problem

2004-02-26 Thread Henry Todd
On 2004-02-26 00:43:21 +, [EMAIL PROTECTED] (Wolf Blaum) said: As I understand Biology, there is 4 nucleotid acids which gives 4**2 combinaions for dupplets. So you need 8 vars to count the occourence of all douplets. Worse for triplets. (24) As I understand genetics, triplets are what matte

Re: Pattern matching problem

2004-02-25 Thread R. Joseph Newton
Kenton Brede wrote: > On Wed, Feb 25, 2004 at 05:52:19PM -, Rob Dixon ([EMAIL PROTECTED]) wrote: > > Kenton Brede wrote: > > > > > > > I'm having trouble counting the number of specific substrings within a > > > > string. I'm working on a bioinformatics coursework at the moment, so my > > > >

Re: Pattern matching problem

2004-02-25 Thread wolf blaum
On Wednesday 25 February 2004 17:35, Henry Todd generously enriched virtual reality by making up this one: Hi, > I'm having trouble counting the number of specific substrings within a > string. I'm working on a bioinformatics coursework at the moment, so my > string looks like this: > > $sequen

RE: Pattern matching problem

2004-02-25 Thread David le Blanc
> From: Bakken, Luke [mailto:[EMAIL PROTECTED] > Sent: Thursday, 26 February 2004 4:59 AM > To: Henry Todd; [EMAIL PROTECTED] > Subject: RE: Pattern matching problem > > > I'm having trouble counting the number of specific substrings > > within a > > s

Re: Pattern matching problem

2004-02-25 Thread Rob Dixon
Kenton Brede wrote: > > Well it seems there is confusion on my part as to which part of the FAQ > to follow. I'm sure there are tons of homework questions done for people > who disguise them. That is one reason I've always felt the "no homework > rule" is superfluous. Personally I have no proble

Re: Pattern matching problem

2004-02-25 Thread Rob Dixon
Kenton Brede wrote: > > OK my mistake. I've been on newsgroups/lists where the "no homework rule" > is enforced and just assumed the FAQ was literal, except for the > "monkey" parts of course. > > I just didn't want the OP to be hanging waiting for an answer when non > would be forthcoming. Hmm.

Re: Pattern matching problem

2004-02-25 Thread Henry Todd
Hi all - Many thanks to those who shared their knowledge. I had a feeling that there would be an elegant solution to my problem, but I was having no luck figuring it out. For reference, where before my code was: $Pcc++ while $sequence =~ /cc/gi; ..it is now: $Pcc++ while $sequence =~ /c(?=c)

Re: Pattern matching problem

2004-02-25 Thread WC -Sx- Jones
Kenton Brede wrote: I just didn't want the OP to be hanging waiting for an answer when non would be forthcoming. Not a mistake per se -- however Perl people (read POD) will always want to show off -- so, if it is Perl, it is likely answered. :) -Sx- (let's not mention cpl.mod) __

Re: Pattern matching problem

2004-02-25 Thread Kenton Brede
On Wed, Feb 25, 2004 at 06:12:55PM +, Henry Todd ([EMAIL PROTECTED]) wrote: > On 2004-02-25 17:42:46 +, [EMAIL PROTECTED] (Kenton Brede) said: > > >If you don't get an answer to your question this is probably why - > > > >http://learn.perl.org/beginners-faq#2.2%20%20what%20is%20this%20list

Re: Pattern matching problem

2004-02-25 Thread Kenton Brede
On Wed, Feb 25, 2004 at 06:30:55PM -, Rob Dixon ([EMAIL PROTECTED]) wrote: > Kenton Brede wrote: > > > > On Wed, Feb 25, 2004 at 05:52:19PM -, Rob Dixon ([EMAIL PROTECTED]) wrote: > > > Kenton Brede wrote: > > > > > > > > > I'm having trouble counting the number of specific substrings withi

Re: Pattern matching problem

2004-02-25 Thread Rob Dixon
Henry Todd wrote: > > On 2004-02-25 17:42:46 +, [EMAIL PROTECTED] (Kenton Brede) said: > > > If you don't get an answer to your question this is probably why - > > > > http://learn.perl.org/beginners-faq#2.2%20%20what%20is%20this%20list%20_not_%20for > > Thanks for the pointer. I should have re

Re: Pattern matching problem

2004-02-25 Thread John W. Krahn
Henry Todd wrote: > > I'm having trouble counting the number of specific substrings within a > string. I'm working on a bioinformatics coursework at the moment, so my > string looks like this: > > $sequence = "caggaactttcggaagaccatgta"; > > I want to count the number of occurrences of each p

Re: Pattern matching problem

2004-02-25 Thread david
Henry Todd wrote: [snip] > > This is how I'm counting the number of "cc" pairs at the moment ($cc is > my counter variable): > > $cc++ while $sequence =~ /cc/gi; > > But this only matches the literal string "cc", so if, as it scans > $sequence, it finds "" it's only counting it once instea

Re: Pattern matching problem

2004-02-25 Thread Rob Dixon
Kenton Brede wrote: > > On Wed, Feb 25, 2004 at 05:52:19PM -, Rob Dixon ([EMAIL PROTECTED]) wrote: > > Kenton Brede wrote: > > > > > > > I'm having trouble counting the number of specific substrings within a > > > > string. I'm working on a bioinformatics coursework at the moment, so my > > > >

Re: Pattern matching problem

2004-02-25 Thread Henry Todd
On 2004-02-25 17:42:46 +, [EMAIL PROTECTED] (Kenton Brede) said: If you don't get an answer to your question this is probably why - http://learn.perl.org/beginners-faq#2.2%20%20what%20is%20this%20list%20_not_%20for Kent Kent Kent Kent - Thanks for the pointer. I should have read the list

Re: Pattern matching problem

2004-02-25 Thread Kenton Brede
On Wed, Feb 25, 2004 at 05:52:19PM -, Rob Dixon ([EMAIL PROTECTED]) wrote: > Kenton Brede wrote: > > > > > I'm having trouble counting the number of specific substrings within a > > > string. I'm working on a bioinformatics coursework at the moment, so my > > > string looks like this: > > > > I

Re: Pattern matching problem

2004-02-25 Thread Rob Dixon
Kenton Brede wrote: > > > I'm having trouble counting the number of specific substrings within a > > string. I'm working on a bioinformatics coursework at the moment, so my > > string looks like this: > > If you don't get an answer to your question this is probably why - > > http://learn.perl.org/b

RE: Pattern matching problem

2004-02-25 Thread Bakken, Luke
> I'm having trouble counting the number of specific substrings > within a > string. I'm working on a bioinformatics coursework at the > moment, so my > string looks like this: > > $sequence = "caggaactttcggaagaccatgta"; > > I want to count the number of occurrences of each pair of > let

Re: Pattern matching problem

2004-02-25 Thread Kenton Brede
On Wed, Feb 25, 2004 at 04:35:57PM +, Henry Todd ([EMAIL PROTECTED]) wrote: > I'm having trouble counting the number of specific substrings within a > string. I'm working on a bioinformatics coursework at the moment, so my > string looks like this: If you don't get an answer to your question

Pattern matching problem

2004-02-25 Thread Henry Todd
I'm having trouble counting the number of specific substrings within a string. I'm working on a bioinformatics coursework at the moment, so my string looks like this: $sequence = "caggaactttcggaagaccatgta"; I want to count the number of occurrences of each pair of letters, for example: Num

Re: file path pattern matching problem.

2003-12-10 Thread B. Fongo
The best way to do it; is using the standard module File::Basename. For instance use File::Basename; # This should return "somefile". $file_name = basename (c:\test\abc\what\somefile.txt); # This should also return "c:\test\abc\what\" $dir_name = dir (c:\test\abc\what\somefile.txt); # filepars

RE: file path pattern matching problem.

2003-12-10 Thread Tom Kinzer
matching problem. Ben Crane wrote: > > Hi all, Hello, > I'm trying to split apart a filepath...e.g: > c:\test\abc\what\somefile.txt > The length of the filepath will never be constant... $ perl -le' use File::Spec; my $path = q[c:\test\abc\what\somefile.txt]; my ( $vol, $

Re: file path pattern matching problem.

2003-12-10 Thread John W. Krahn
Ben Crane wrote: > > Hi all, Hello, > I'm trying to split apart a filepath...e.g: > c:\test\abc\what\somefile.txt > The length of the filepath will never be constant... $ perl -le' use File::Spec; my $path = q[c:\test\abc\what\somefile.txt]; my ( $vol, $dir, $file ) = File::Spec->splitpath(

RE: file path pattern matching problem.

2003-12-10 Thread Balint, Jess
OTECTED] > Sent: Wednesday, December 10, 2003 9:22 AM > To: [EMAIL PROTECTED] > Subject: file path pattern matching problem. > > > Hi all, > > I'm trying to split apart a filepath...e.g: > c:\test\abc\what\somefile.txt > The length of the filepath will n

file path pattern matching problem.

2003-12-10 Thread Ben Crane
Hi all, I'm trying to split apart a filepath...e.g: c:\test\abc\what\somefile.txt The length of the filepath will never be constant... e.g: foreach $line (@Path_Filename) { chomp($line); (@Path_Breakdown) = split(/(\w+\W)(\w+\W)/, $line); } but my biggest problem is how to match a

Re: Pattern matching problem

2001-09-20 Thread Pete Sergeant
Some other notes... You don't have to use printf - you can use print. And you don't need the brackets, or the inverted commas around $path: if ($path =~ m/^\$/) { print "Path is env var\n"; } else { print "Working on phys.dir\n"; } > > if ( "$path" =~ /^$/ ) { > >printf("p

Re: Pattern matching problem

2001-09-20 Thread Sudarsan Raghavan
/^$/ matches a blank line, /^\$/ will do the job for you. $ is a metacharacter, you will have to escape it. It matches at the end of a line or before newline at the end. hth. Sudarsan Tanya Bar wrote: > > Path could be physical or start with environment variable; so in my script > I'm trying

Pattern matching problem

2001-09-19 Thread Tanya Bar
Hi, All! I'm very new in Perl, so may be I'm doing something wrong. Please help me with this : my script read configuration file, that looks like this: #- #hostname #username #Path#gzip after #delete after hpn003