How to check the FILE HANDLE STATUS ???

2004-09-24 Thread Madhu Reddy
hi, I want to check the status of File handle before reading/writing to file ? How to do this ? like following open(FH_IN_FILE, ">file.txt"); # This statement is executed by some other function close(FH_IN_FILE); print FH_IN_FILE "SOME DATA"; here before writing to file, i want to check

Re: SEARCH & REPLACE

2004-05-05 Thread Madhu Reddy
return 0; } here i am closing previously opened file... if i want to open a file in write mode, we have to specify ">$file" right ? does >$file will work ? I will drop if m/... Thanks -Madhu --- James Edward Gray II <[EMAIL PROTECTED]> wrote: > On May 5, 2004, at 12:

Re: SEARCH & REPLACE

2004-05-05 Thread Madhu Reddy
--- James Edward Gray II <[EMAIL PROTECTED]> wrote: > On May 5, 2004, at 11:03 AM, Madhu Reddy wrote: > > > -replace.pl--- > > #!/bin/perl -w > > > > # INPUT STRING > > my $in_str = ".import "; > > >

SEARCH & REPLACE

2004-05-05 Thread Madhu Reddy
-replace.pl--- #!/bin/perl -w # INPUT STRING my $in_str = ".import "; # REPLACE STRING my $repl = "/home/madhu/apps/toll.txt"; $_=$in_str; # I don't want to use following, because # "TOLL_FREE" will be changed each time #s//$repl/; # FOLLOWING WILL NOT WORK #s/_IFILE>

Re: SIMPLE SEARCH AND REPLACE

2004-05-04 Thread Madhu Reddy
uot; is fixed and common for all.. How to replace this ? --- James Edward Gray II <[EMAIL PROTECTED]> wrote: > On May 4, 2004, at 10:54 AM, Madhu Reddy wrote: > > > Hi, > >in a file, I have following variables, > > > > > > > > > >

SIMPLE SEARCH AND REPLACE

2004-05-04 Thread Madhu Reddy
Hi, in a file, I have following variables, I want to replace those variables with values basically i want to replace all <*_IFILE> with some value say file.txt How to do this in perl ? Thanks __ Do you Yahoo!? Win a $2

help on regular expression

2004-01-27 Thread Madhu Reddy
Hi, I need some help on regular expression... i have following in variable $total_count $total_count = "##I USBP 01 10:38:09(000) ETRACK_TOTAL_RECS : 100" Here in this ETRACK_TOTAL_RECS is fixed and common for all and rest is changing... like following $total_count = "##I USBP 02 12

how to create/use data structures in perl ?

2003-07-08 Thread Madhu Reddy
Hi, How to create data structures in perl ? I have following data structure in C...and i have to create similar data structure in perl and use... how to create data strutures in perl and how to use ? typedef struct { charPrefix[8]; charPrint;

ASCII Manipulation in perl

2003-07-07 Thread Madhu Reddy
Hi, I want to write following C Equivalant with PERL My perl equvalant is at the end of this mail.. please correct me... my questios are inside perl comments... -- C Code start - for(i=0;i<(int)strlen(Buffer);i++) { if((Buffer[i] < 32) || (Buffer[i] > 126)) { if((Buffer[i]

Fwd: ASCII Manipulation in perl

2003-07-07 Thread Madhu Reddy
--- Madhu Reddy <[EMAIL PROTECTED]> wrote: > Date: Mon, 7 Jul 2003 10:39:51 -0700 (PDT) > From: Madhu Reddy <[EMAIL PROTECTED]> > Subject: ASCII Manipulation in perl > To: [EMAIL PROTECTED] > > Hi, > I want to write following C Equivalant with PERL > My

ASCII Manipulation in perl

2003-07-07 Thread Madhu Reddy
I didn't get this mail... I am re seinding Hi, I want to write following C Equivalant with PERL My perl equvalant is at the end of this mail.. please correct me... my questios are inside perl comments... -- C Code start - for(i=0;i<(int)strlen(Buffer);i++) { if((Buffer[i] <

How to add and remove spaces in a record

2003-07-05 Thread Madhu Reddy
Hi, I have file to load into database... the file contains fixed length records.. basically i need to check for record lengths before loading into database.. suppose my fixed record length is 25 i have to read each record then of recors length is more than 25, delete the chars after 25...basi

RE: PERL HANG on WINDOWS AND WAITING FOR TO PRESS ENTER

2003-06-30 Thread Madhu Reddy
quotes, not backticks. > Backticks are a special quote-like operator that > runs the command in as if > it was run on the command-line and then passes the > results back. So you > would use backticks like this: > > my $result = `command`; > > -Original Message

RE: PERL HANG on WINDOWS AND WAITING FOR TO PRESS ENTER

2003-06-30 Thread Madhu Reddy
the old STDERR in so that you > can put it back later, but > this shouldn't be necessary in Windows. > > -Original Message- > From: Madhu Reddy [mailto:[EMAIL PROTECTED] > Sent: Monday, June 30, 2003 8:54 AM > To: [EMAIL PROTECTED] > Subject: PERL HANG on WINDOW

PERL HANG on WINDOWS AND WAITING FOR TO PRESS ENTER

2003-06-30 Thread Madhu Reddy
Hi, When i run perl programs, some times it will hang in the middle of program...and when i press then it is going to next step.. But it will not happen all the times... once some times it is hapenning i don't know what could be the reasons... my plat form is Windows 2000 and i am using

Re: reading file into hash?

2003-06-23 Thread Madhu Reddy
This will do ... alpha_hash is u r hash... - my %alpha_hash = (); open(FH_D,"$d_list") || die "File opening $d_list\n"; @file_list = ; foreach $record (@file_list) { @t_array = split(/\|/, $record); $alpha_hash{$t_array[0]} = $t_array[1]; } close(FH_D); --- Tim

Re: reading file into hash?

2003-06-23 Thread Madhu Reddy
This will do ... alpha_hash is u r hash... - my %alpha_hash = (); open(FH_D,"$d_list") || die "File opening $d_list\n"; @file_list = ; foreach $record (@file_list) { @t_array = split(/\|/, $record); $alpha_hash{$t_array[0]} = $t_array[1]; } close(FH_D); --- Tim

find and replace string

2003-06-13 Thread Madhu Reddy
Hi, I want to find and replace string with particular pattern my $str = " 13 A.MFDF_FEEDER_ET"; $str =~ s/\s+//g; here i want to replace string that end with "_ET" with null basically i wanto get result 13 in $str. how to do this? I really appreciate u r help Thanks

Is there any Polling mechanism in perl ?

2003-04-04 Thread Madhu Reddy
Hi, Is there any polling mechanism in perl ? Following is my problem.. my program has to wait (poll) on particular folder... If any file arrived on that folder, my main program has to invoke another program... In Unix, we have poll() system call for waiting on particular event ? is there any s

Command line argurments to perl program

2003-04-02 Thread Madhu Reddy
Hi, I want to pass command line arguements to perl program ? How to do this ? Thanks -Madhu __ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For ad

LSOF in perl [list open files]

2003-04-02 Thread Madhu Reddy
Does anybody know, is there any lsof, unix equivalant utility in perl (on windows) Thanks in advance -Madhu __ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com -- To unsubscribe, e-mail: [EMAIL PRO

RE: How to check ASCII chars in perl ?

2003-03-09 Thread Madhu Reddy
> >> i don't thing the above will work. try: > >> > >> for(split(//)){ > >> if(ord < 32 || ord > 126){ > >> print "Char is non printable char\n"; > >> }else{ > >> print "$_\n"; > >> } > >> } I want to do following, if any char is ASCII value of 10 or 13, i want to make that char as null like fo

How to check ASCII chars in perl ?

2003-03-07 Thread Madhu Reddy
Hi, I want to check for some ASCII chars in perl like following "C" code.. How to do this in Perl ? follwing will work in perl ? for($i=0;$i < length;$i++) { if (($_[$i] < 32) || (($_[$i] > 126)) { print "Char is non printable char\n"; } } following is C code for(i=0;i<(int)strlen(Buffer);

How to pass perl variables between files

2003-03-03 Thread Madhu Reddy
Hi, I want to find out how to pass perl variables between files and functions... in C, we declare with "extern" to work in different files how to do in perl... between files means , i declare variable in file1 and file2 will update those variables and want to access in file1 Ex: like $var1 a

Re: Perl Application error on windows

2003-02-27 Thread Madhu Reddy
> > - > > if you do perl -V, do you see a line that looks > like: > > usethreads=define use5005threads=undef > useithreads=define > usemultiplicity=define > > NO, I didn't see that one... following is my perl -v output how to debug that error.. i started my script with debug option.. sti

Re: Perl Application error on windows

2003-02-27 Thread Madhu Reddy
, Larry Wall Binary build 805 provided by ActiveState Corp. http://www.ActiveState.com Built 18:08:02 Feb 4 2003 - --- david <[EMAIL PROTECTED]> wrote: > Madhu Reddy wrote: > > > Hi, > > I have following sorting program... > > basically it will split the large

Perl Application error on windows

2003-02-27 Thread Madhu Reddy
Hi, I have following sorting program... basically it will split the large files into small file and creates thread..each thread will sort files after that merge back all sorted files... this program works fine on single CPU machine... same program giving problem on 8 CPU machine... the problem

Re: locks in threads

2003-02-27 Thread Madhu Reddy
0x2808335c" referenced memory at "0x0004". The memory couldn't be written this error is because of not doing lock on %bounds ? when we do the lock like lock(%bounds) does it lock all the elements in hash ? Thanx Madhu Thanx -Madhu --- david <[EMAIL PROTE

locks in threads

2003-02-26 Thread Madhu Reddy
hi, I just want to find out how and when to use locks in threads... i have following program.. in following %bounds is global variable each thread will update %bounds and later i am using %bounds... do i have lock the %bounds before each thread update ? my %bounds = (); for(@tmp_file

Multi threading in perl

2003-02-24 Thread Madhu Reddy
Hi, does anybody have sample perl script multi threaded program any site does talks about perl multi threading I appreciate u r help Thanx -Madhu __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/

Re: how to sort a big file

2003-02-24 Thread Madhu Reddy
t; . $counter++ . ".txt"; . } following are the statistics... it took 5:30 hours to sort 13 millions record file... on 8 CPU's and 8GB RAM how to improve the speed i think 5 hours is more Thanx -Madhu --- david <[EMAIL PROTECTED]> wrote: > Madhu Reddy wrote: >

RE: Out of memory while finding duplicate rows

2003-02-24 Thread Madhu Reddy
that is true..before loading into database...we need to do some validations if input file contains morethan 5% duplicates, don't load into databse... that is why i am finding duplicates... Thanx -Madhu --- "Beau E. Cox" <[EMAIL PROTECTED]> wrote: > Thanks Peter - good point > > > -Origi

RE: Out of memory while finding duplicate rows

2003-02-22 Thread Madhu Reddy
$_; $good++; } last_$_ = $_; } then only thing is we need to find out how much time it will take to sort 22 millino rows file Any comments ? sugegestions ? --- "Beau E. Cox" <[EMAIL PROTECTED]> wrote: > Hi - > > > -Original Message- &

Out of memory while finding duplicate rows

2003-02-22 Thread Madhu Reddy
Hi, I have a script that will find out duplicate rows in a file...in a file i have 13 millions of records out of that not morethan 5% are duplicate for finding duplicate i am using following function... while () { if (find_duplicates ()) { $dup++ } } # return 1, if

How to get 1st line, last line and no of lines in a file

2003-02-18 Thread Madhu Reddy
Hi, How to get first line, last line and no of lines in a file. is there any perl functions available for that ? right now what i am doing is open file while ( { $lines++; } close(FH) This operation is expensive.. suppose, if file have millions of records, it will take more time I t

Re: Sending e-mail from perl script using SMTP on Windows!!! working now

2003-02-18 Thread Madhu Reddy
Hi Guys, now it's working fine there is typeo in e-mail address i put email address as '[EMAIL PROTECTED]' here typeo... actual is "redy.ponnolu" now, how to chatch this type of erros in script... if i put wrong e-mail address...does it bounce back ? how to

Sending e-mail from perl script using SMTP on Windows

2003-02-18 Thread Madhu Reddy
Hi, This is regarding sending e-mail from perl script using SMTP my script is running fine..but i am not getting any mail which i sent from script... following is my program correct me if any thing is wrong in the script. messages with debug option attached at the end. -

Too may arguements Error

2003-02-17 Thread Madhu Reddy
Hi, i have a script with multi files... in one file, i defined all the functions.. and from other file i am calling the functions... suppose, following is my function defination... sub log_msg() { print LOG "@_\n"; } i am calling this function with log_msg("Running script\n") here i

How to avoid this Warning ?

2003-02-17 Thread Madhu Reddy
Hi, I have following script, basically this will ding the duplicate rows in a file... I am getting following warnings Use of uninitialized value at Audit_WTN.pl line 133, chunk 18. Use of uninitialized value at Audit_WTN.pl line 133, chunk 19. how to avoid warning at following location 13

How to set environment variables

2003-02-17 Thread Madhu Reddy
Hi, I want to put MFILE=mdl_data.txt in ENV and want to access later.. i am trying following...I am getting error... system(`MFILE=mdl_data.txt`); $k6 = "MFILE"; $key6 = $ENV{$k6}; print "$key6 \n"; how to do this ? Thanx -Madhu __ Do you Yah

RE: How to Add spaces at the end of a line

2003-02-11 Thread Madhu Reddy
> > > > while() { > >if (length($_) == 263) { > > Add 2 spaces to the end (before new line > char) > > of $_ > > $_ .= ' '; > # or > $_ .= ' ' x 2; > > > >} > > } > > > > How to do this ? $_ will have newline char.. ' '(2 spaces) added after the new

How to Add spaces at the end of a line

2003-02-11 Thread Madhu Reddy
Hi, I want to do some data validation... I hvae to read each (row)line in a file and have to check the length of each row, if length of row is 263 I need to add 2 spaces at the end of line (row) to make 265 row lenghth .. Here how to add spaces at the end of length while() { if (length($_)

how to sort a big file

2003-02-11 Thread Madhu Reddy
Hi, I want to sort a file and want to write the result to same file I want to sort a based on 3rd column.. following is my file format C1 C2 C3 C4 1234 guhr 89890 uierfer 1324 guii 60977 hiofver 5467 frwf 56576 err i want to sort above file based on column 3(C3) and i want t

Re: finding rows in a large file (22 millions of rows)

2003-02-10 Thread Madhu Reddy
> > 1 word. Oracle. > > This is really why database software exists. I know > this probably > didn't help much, but if this is more than a one > time occurrence a real > database ought to be considered. > > You might start by checking out any reference > material on how large > database syst

Re: finding rows in a large file (22 millions of rows)

2003-02-10 Thread Madhu Reddy
C1 C2 C3 C4 12345 efghij klmno pqrs 34567 abnerv oiuuy uyrv 94567 abnerv gtuuy hyrv 12345 aswrfr rtyyt erer 94567 abnerv gtuuy hyrv Here row1 and row4 are duplicates...those needs to be removed or moved to another file --- Madhu Reddy <[EM

finding rows in a large file (22 millions of rows)

2003-02-10 Thread Madhu Reddy
Hi, I want find a duplicate records in a large file it contains around 22 millions records. basically following is my file structure C1 C2 C3 C4 12345 efghij klmno pqrs 34567 abnerv oiuuy uyrv ... ... ... ...

Re: perl behaviour on Multi processor machine

2003-02-10 Thread Madhu Reddy
) ? Thanx -Madhu --- david <[EMAIL PROTECTED]> wrote: > Madhu Reddy wrote: > > > Hi, > >When i ran perl script on multi processor > > machine... > > it is taking more time as than on single processor > > machine > > > > Let me explai

perl behaviour on Multi processor machine

2003-02-10 Thread Madhu Reddy
Hi, When i ran perl script on multi processor machine... it is taking more time as than on single processor machine Let me explain clearly I have big file (.5Gb) it has 8 million records... my perl script will read each record and validates.. Validation includes..checking each record l

How to Handle Large files in Perl ?

2003-02-07 Thread Madhu Reddy
Hi, We are doing file operations on large files(more than 5GB). basically reading the file and validatiing the each record in in the file. we used Tie::File It took 35 min to read and count the number of lines in file of 8millions (500MB) following is the script Does anybody have a

Re: How to send an e-mail from perl script on windows using SMTP?

2003-02-06 Thread Madhu Reddy
This script is running where my e-mail client is (MicroSoft Look)... I am not running on remote.. I am running on localNetwork I am using Microsoft Outlook 2002 I used following procedure to get the my-email server name - 1. On Outlook "Tools>options>Mail Setup===>E-mail Accoun

RE: How to send an e-mail from perl script on windows using SMTP?

2003-02-06 Thread Madhu Reddy
at > the command prompt. If > you get a connection refused or denied message, then > you will not be able to > send the email from your script. > > -Original Message- > From: Madhu Reddy [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 05, 2003 6:11 PM > To: [EM

Re: How to send an e-mail from perl script on windows using SMTP?

2003-02-05 Thread Madhu Reddy
I changed to Net::SMTP still i am getting following error Couldnt make Connection: Unknown error --- david <[EMAIL PROTECTED]> wrote: > Madhu Reddy wrote: > > > use NET::SMTP ; > > should probably be: > > use Net::SMTP; > > unless N

How to send an e-mail from perl script on windows using SMTP?

2003-02-05 Thread Madhu Reddy
Hi, I want to send an e-mail from perl script i have following script...but i am getting following error. does anybody have any idea, why it is failing ? == following is error message -- Couldnt make Connection: Unknown error --- following is script ===