Re: Multiple matching of a group of characters

2012-10-01 Thread Brandon McCaig
On Mon, Oct 01, 2012 at 11:15:53PM +0100, Florian Huber wrote: > Dear all, Hello, > $string = "/NOTNEEDED/*ACGACGGGTTCAAGGCAG*/NOTNEEDED/" I would suggest that you show us the real data. I'm assuming that 'NOTNEEDED' is a placeholder for some data that you're not interested in. Without knowing w

Re: Multiple matching of a group of characters

2012-10-01 Thread Andy Bach
On Mon, Oct 1, 2012 at 5:15 PM, Florian Huber wrote: > > My confusion was complete when I tried > > $string =~ /[ACGT]{5}/; > > now it matches 5 letters, but this time from the beginning, i.e.: ACGAC. >I'm trying to extract a DNA sequence out of a larger string, i.e. the string >is of the follow

Re: Multiple matching of a group of characters

2012-10-01 Thread Jim Gibson
On Oct 1, 2012, at 3:15 PM, Florian Huber wrote: > Dear all, > > I'm trying to extract a DNA sequence out of a larger string, i.e. the string > is of the following structure: > > $string = "/NOTNEEDED/*ACGACGGGTTCAAGGCAG*/NOTNEEDED/" > > But when I do > > $string =~ /[ACGT]/; > > it matches

Multiple matching of a group of characters

2012-10-01 Thread Florian Huber
Dear all, I'm trying to extract a DNA sequence out of a larger string, i.e. the string is of the following structure: $string = "/NOTNEEDED/*ACGACGGGTTCAAGGCAG*/NOTNEEDED/" But when I do $string =~ /[ACGT]/; it matches only the last letter, i.e. "G". Why doesn't it start at the beginning?

Re: delete blank lines from text file

2012-10-01 Thread Chris Stinemetz
On Mon, Oct 1, 2012 at 3:34 AM, Irfan Sayed wrote: > hi, > > i need to delete all blank lines from the text file > > I usually just skip the blank lines when I read the data one line at a time. Then you can print to a new file. My example is below: #!/usr/bin/perl use 5.010; use strict; use war

Re: delete blank lines from text file

2012-10-01 Thread Irfan Sayed
thanks a lot ! will improve the coding standard. regards, irfan From: Shlomi Fish To: Irfan Sayed Cc: Perl Beginners Sent: Monday, October 1, 2012 4:08 PM Subject: Re: delete blank lines from text file Hi Irfan, On Mon, 1 Oct 2012 01:34:51 -0700 (PDT) I

Re: delete blank lines from text file

2012-10-01 Thread Shlomi Fish
Hi Irfan, On Mon, 1 Oct 2012 01:34:51 -0700 (PDT) Irfan Sayed wrote: > hi, > > i need to delete all blank lines from the text file > How do you define a blank line? Is it an empty line? Is it a line that contains only whitespace? In any case, here are a few comments on your code and after

Re: delete blank lines from text file

2012-10-01 Thread Kuldeep Dhole
Hi, I can suggest an algo 1) read a file into an array : file -> @array 2) @array = grep defined, @array (this removes all the blank values from an @array) 3) write array again back to file kind regards, Kuldeep On Mon, Oct 1, 2012 at 2:04 PM, Irfan Sayed wrote: > hi, > > i need to delete all

delete blank lines from text file

2012-10-01 Thread Irfan Sayed
hi, i need to delete all blank lines from the text file wrote following code. however, all the blank lines are not getting deleted. please suggest open FILE,"+<", 'C:\Users\bvcontrolbuild\Desktop\test.txt';  while ()    {     chomp;     push (@lines, "$_\n");    }   close F