RE: hashing - cannot remember how :(

2002-01-18 Thread SathishDuraisamy
-Original Message- From: Hanson, Robert [mailto:[EMAIL PROTECTED]] Try this. You didn't provide any sample data, so this is untested. $data{ week } = \%week_day_date; $data{ eng } = \%eng_info; &build_table_date( 5, %data ); sub build_table_date { my( $rows, %data ) = @_; fore

Finding a running process in Windows

2002-01-16 Thread SathishDuraisamy
Hi All, Does anyone know how to find ( in a PERL script running under Windows) whether a process( program ) is already running or not. In Unix, I can easily do this using the 'ps' command in backticks. I don't know how to do this in Windows. Any thoughts? Thanks, sathish -- To unsubscrib

RE: This Simple program won't work - why?

2002-01-11 Thread SathishDuraisamy
open (infile, "<>snert.cgi"); ^^ Use single '>'. open (infile, "snert.cgi"); [sathish] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

PerlEz question

2002-01-07 Thread SathishDuraisamy
This is more like a non-PERL question...but since it involves PerlEz.dll I am addressing this mailing-list :-) I need to have my servlets invoke a PERL subroutine through PerlEz.dll (using JNI) on the web server side. The PERL subroutine may take few seconds to perform its job. PerlEz document

RE: Strange (from my perspective) regex behavior

2002-01-04 Thread SathishDuraisamy
Will this help? open (INFILE, 'ads.txt' ) or die "Error opening file ($!)"; my @ad_lines = (); while ( ) { s/^\s+|\s+$//g; # Chop off leading, trailing space next unless $_; # Skip empty lines last if /\/\-+advertisement/; push( @ad_lines, $_ ) if /^\s*\d+\./; } #

RE: Strange (from my perspective) regex behavior

2002-01-04 Thread SathishDuraisamy
I am trying to extraxt some text from a file using a regular expression. It is not behaving as expected and am totally perplexed as to why. Here is an excerpt of the text 1. Top Story: Dynegy in Agreement to Get Enron Pipeline 2. M&A: Newmont-Normandy, Hewlett-Compaq, Pax TV, WorldCom 3. Invest

RE: Print / overwrite line

2002-01-03 Thread SathishDuraisamy
I couldn't understand what you are trying to do. Could you please attach the portion of your PERL code? [sathish] > How can I clear a line before replacing it? > > Am doing \r and overwriting, but sometimes the text that was there previously > is longer than the new text. > > gary -- To unsub

RE: another easy question (actually 3)

2002-01-03 Thread SathishDuraisamy
Timothy, I'd use a proper module for something like this. CSV data can get tricky, so see if you can install Text::CSV_XS. Here's some sample code: use strict; use Text::CSV_XS; > Curtis, > I couldn't find this module in my standard PERL lib path. I guess I should get this from c

RE: another easy question (actually 3)

2002-01-03 Thread SathishDuraisamy
But now I want to print this in csv format: "cheese","olives","beans","carrots". > Be careful. The CSV formated line can get trickier if it > already contains a comma or a double-quote. For example, > the line > chee,se oli"ves beans carrots > should be translated to > "chee,se","oli""ves",b

RE: another easy question (actually 3)

2002-01-03 Thread SathishDuraisamy
I find that I get a zero-length field for $headers[0] and don't understand why. Trim the leading and trailing spaces, like this: s/^\s+|\s+$//g; Lastly, does /\s+/ mean 2 or more spaces or does it mean one or more spaces, '+' "means one or more"; '*' means "zero or more"; They are post-fix.

RE: find blank line

2002-01-02 Thread SathishDuraisamy
That's right. But let me add my 5cents to it. If you decide to use the construct "while ( )..." then it better be while( defined() ) { //... } [sathish] -Original Message- From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 2:44 PM To: Booher Timothy

RE: find blank line

2002-01-02 Thread SathishDuraisamy
Could you tell what you do inside the while loop? If you declare local variables and assign values to them from the contents read from file, then chances are that the values read from the file are null and the variables still unassigned. For example, open( MYFILE, "file.txt" ) or die; while ( my

RE: Question!! number of line....

2001-12-28 Thread SathishDuraisamy
require 5; sub get_line_num { my ($file_name, $string_to_look_for) = @_; my $line_num = -1; open ( MYFILE, $file_name ) or die "Error opening file '$file_name'. Reason is <$!>"; while ( ) { if ( /$string_to_look_for/i ) { $line_num = $.; last; } } close( MY

RE: Output to email

2001-12-28 Thread SathishDuraisamy
Or better use this. my $subject_line = substr( $line, 43, 7 ); %main = ( To => '[EMAIL PROTECTED]', From=> '[EMAIL PROTECTED]', Subject => "$subject_line", Message => 'whatever' ); ... [Sathish] -Original Message-

RE: Output to email

2001-12-28 Thread SathishDuraisamy
The value for the hash-key 'Subject' should be a scalar such as a number or string. It shouldn't be a 'print' statement. Just use the substr() which returns a string. %mail = ( To => '[EMAIL PROTECTED]', From=> '[EMAIL PROTECTED]', Subject => substr($line