fun with regex

2002-12-11 Thread Selector, Lev Y
Hello, Here is a regex question I am using the following construct to ident embeded SQL: ($sql =EOF) =~ s/^\s+SQL: ?//gm; SQL: select row_id SQL: from gs_employee_queue g_q SQL: where g_q.MMDDHHMM = '$MMDDhhmm' SQL:and g_q.action = 'D' SQL:and

limit the list

2002-11-19 Thread Selector, Lev Y
Folks, Simple question: Is there a more elegant way to express this: an array of names is converted into a comma-separated list. if the list gets to long - limit it and add , etc. at the end. $str = join ', ', @names; if (length($str)90) { ($str = substr($str,0,90)) =~

incrementing values in base 36

2002-10-11 Thread Selector, Lev Y
Hello, I have integer numbers represented in base 36 (each digit may have one of 36 values: ('0'..'9','A'..'Z')). For example: '5BFHK'. I need to increment the number by 1 or by some step (for example, by 25). Here is my first take on incrementing by 1: # - #

removing extra empty lines

2002-08-12 Thread Selector, Lev Y
Folks, I have a long file which has many empty lines with nothing but may be spaces or tabs (/^\s*$/). These lines tend to group together creating chunks of empty vertical space on the printout. I want to reduce the number of empty lines in such chunks to 1 line. What would be an elegant

RE: removing extra empty lines

2002-08-12 Thread Selector, Lev Y
Wow! This was fast. And it works too! Warmest Regards, Lev Selector -Original Message- From: Ronald J Kimball [mailto:[EMAIL PROTECTED]] Sent: Monday, August 12, 2002 1:33 PM To: Selector, Lev Y Cc: [EMAIL PROTECTED] Subject: Re: removing extra empty lines On Mon, Aug 12, 2002

reading lines backwards

2002-06-11 Thread Selector, Lev Y
Folks, Problem: need to read a very big text file starting from the end and moving backwards to its beginning. This is similar to a diamond ( FH ) operator functionality - but in the opposite direction. Need to do it without reading and reversing the array of lines for the whole file (which

RE: Just-another-Perl-hacker

2001-09-24 Thread Selector, Lev Y
Ilmari, Thank you. This was really elegant. Here is your script after some remaking to make clear what it is doing: # package UNIVERSAL; sub myprint { print in myprint - 1\n; print @_\n; print in myprint - 2\n; @_=@_; # removes