Re: Elegant sequencing

2004-08-29 Thread Bryan Harris
> I don't claim to be a master, but you can do something along the lines of: > > $range = '4.3:8.3'; > $range =~ /(\d+).(\d+).(\d+).\2/ and print map "$_.$2 ", $1 .. $3; > > Since it appears you require that the fractional part be the same for both > ends of the range

Re: Elegant sequencing

2004-08-29 Thread Randy W. Sims
On 8/29/2004 2:36 AM, Bryan Harris wrote: I don't claim to be a master, but you can do something along the lines of: $range = '4.3:8.3'; $range =~ /(\d+).(\d+).(\d+).\2/ and print map "$_.$2 ", $1 .. $3; Since it appears you require that the fractional part be the same for both ends of the range,

Re: how add something in MySQL what is not activated immediately

2004-08-29 Thread Sergei Yatsenko
Make another field in DB and call it "active" or something. Set it by default to "0". Then you will activate it by setting active="1" for that record. Sergei. "Maxipoint Rep Office" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > this is good idea, but in some cases I must have m

Re: Regular expression generator/creator

2004-08-29 Thread Jenda Krynicky
From: Philipp Traeder <[EMAIL PROTECTED]> > You're right - the problem I'm trying to solve is quite restricted - > and I'm very thankful for this ;-) Basically, I'm trying to write an > application that "recognizes" log file formats, so that the following > lines are identified as several manifesta

Re: Regular expression generator/creator

2004-08-29 Thread Jenda Krynicky
From: Philipp Traeder <[EMAIL PROTECTED]> > I'm facing a roughly similar problem at the moment, and I was planning > on using String::Compare or something like it for comparing strings > char by char. Taking a first glance at the code, it doesn't look too > hard to modify it in a way that it return

Merging lines in a file

2004-08-29 Thread Jan Eden
Hi, I had the following task: Open a file, read it and merge all pairs of lines containing a certain number of tabs. Example: Blablabla abc cab bca 123 453 756 Blablabla Blablabla Here, lines 2 and three should be merged, while the other lines should remain untouched. Expected result: Blablab

Re: Merging lines in a file

2004-08-29 Thread Gunnar Hjalmarsson
Jan Eden wrote: I had the following task: Open a file, read it and merge all pairs of lines containing a certain number of tabs. Example: Blablabla abc cab bca 123 453 756 Blablabla Blablabla Here, lines 2 and three should be merged, while the other lines should remain untouched. Expected result: B

Re: Merging lines in a file

2004-08-29 Thread John W. Krahn
Jan Eden wrote: Hi, Hello, I had the following task: Open a file, read it and merge all pairs of lines containing a certain number of tabs. Example: Blablabla abc cab bca 123 453 756 Blablabla Blablabla Here, lines 2 and three should be merged, while the other lines should remain untouched. Expec

RE: Merging lines in a file

2004-08-29 Thread Charles K. Clarkson
Jan Eden <[EMAIL PROTECTED]> wrote: : I had the following task: Open a file, read it and merge all : pairs of lines containing a certain number of tabs. Example: : : Blablabla : abc cab bca : 123 453 756 : Blablabla : Blablabla : : Here, lines 2 and three should be merged, while the other : line

Re: Merging lines in a file

2004-08-29 Thread John W. Krahn
Jan Eden wrote: Hi, Hello again, I had the following task: Open a file, read it and merge all pairs of lines containing a certain number of tabs. Example: Blablabla abc cab bca 123 453 756 Blablabla Blablabla Here, lines 2 and three should be merged, while the other lines should remain untouched.

How add 8 hours to a time variable

2004-08-29 Thread Yw Chan \( Cai Lun e-Business \)
Hi, I'm a newbie to Perl, see if anyone of you can kindly help? How should I add 8 hours to a date-time variable that's keeping the unix time? Thanks, CHAN

Function to escape special characters

2004-08-29 Thread Yw Chan \( Cai Lun e-Business \)
Hi, See if anyone out there can help again. Is there a Perl function for escape special characters in a variable easily? So I don't need to use s/../... explicitly for each of them? Thanks, Yw

RE: Function to escape special characters

2004-08-29 Thread Charles K. Clarkson
Yw Chan ( Cai Lun e-Business ) <[EMAIL PROTECTED]> wrote: : Hi, : : See if anyone out there can help again. : : Is there a Perl function for escape special characters in : a variable easily? So I don't need to use s/../... : explicitly for each of them? Which special characters are you refer

Re: How add 8 hours to a time variable

2004-08-29 Thread Gunnar Hjalmarsson
Yw Chan ) wrote: > How should I add 8 hours to a date-time variable that's keeping the > unix time? $var + 8 * 60 * 60 Depending on format, you may need to parse the string first, using for instance the Date::Parse module. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: Function to escape special characters

2004-08-29 Thread Gunnar Hjalmarsson
Yw Chan ) wrote: > Is there a Perl function for escape special characters in a > variable easily? Yes. You are supposed to look it up in "perldoc perlfunc" yourself rather than asking others to do so for you. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscri

RE: Merging lines in a file

2004-08-29 Thread Jan Eden
Hi, thanks for all the suggestions. I originally tried to avoid slurping the whole file into memory, but got stuck using the $. variable to address a line and the one following it. Thanks John and Gunnar for pointing me to the right direction, and thanks to Charles for his extensive comments.