Dear Bill, First of all thank you for your response.
Hmmm as you know basically I am calling a java program and the output generated by it is what I am putting inside the variable $line so that I can get better solution to my problem. Hmm the output generated by it is in this format : output generated by [ cctest.java ] ~~~~~~~~~~~~~~~~~~~~~ <output> Using ClearCommerce SSL API Version: release-3-8-3-17 Thu Mar 15 10:33:06 CST 2001 Charge Total: 20.00 Time - Sat Jun 29 15:32:19 2002 Ref# - 12345678 Appr - APPROVED Code - 12345612345678 Err - Ord# - 12.45.92.15-1025382739-376645-13757-21 <output> I just copied that block and put it into variable. From what I see I can say that there is <newline>, not so sure about <tab> spacing. Let me know what you think. Have a great day. karthikeyan. ----- Original Message ----- From: $Bill Luebkert <[EMAIL PROTECTED]> To: karthikeyan <[EMAIL PROTECTED]> Sent: Sunday, June 30, 2002 9:01 AM Subject: Re: [Perl-unix-users] Perl with Java - ONCE AGAIN > > karthikeyan wrote: > > Dear Michael, > > > > May be I didn't put my question properly. When I run the following code. > > > > <snip> > > > > #!d:/karthikeyan/programs/perl/bin/perl -w > > print "Content-type:text/html\n\n"; > > use strict; > > my $line = 'Using ClearCommerce SSL API Version: release-3-8-3-17 Thu Mar > > 15 10:33:06 CST 2001 > > Charge Total: 20.00 > > Time - Sat Jun 29 15:32:19 2002 > > Ref# - 12345678 > > Appr - APPROVED > > Code - 12345612345678 > > Err - > > Ord# - 12.45.92.15-1025382739-376645-13757-21'; > > my @colon = $line =~ /(\S+):\s+(\S+[^:])/g; > > my @hyphen = $line =~ > > /(\S+)\s-\s([^-]+)(?:\s[^-]+){2}|(\S+)\s-\s(\S+)\s*$/g; > > for (@hyphen) { > > next unless defined; > > push @colon, $_; > > } > > my %hash = @colon; > > for (sort keys %hash) { > > print "$_ == $hash{$_}\n" > > } > > exit 0; > > > > </snip> > > > > I am getting the following output > > > > <output> > > Code == 12345612345678 Ord# == 12.45.92.15-1025382739-376645-13757-21 Time > > == Sat Jun 29 15:32:19 Total == 20.00 Version == release-3-8-3-17 > > </output> > > > > These are the name along with its value missing > > > > <missing> > > Ref# - 12345678 > > Appr - APPROVED > > </missing> > > > > I am not good at Regexp so cant say what I need to include in the search to > > make this work. Otherwise this code is great :). > > Can you provide a dump of the data below or insert \t, \r and \n wherever > they may occur so we have the data correct ? In particular are there newlines > in there or not ? It makes it a lot easier if there are. > > my $line = 'Using ClearCommerce SSL API Version: release-3-8-3-17 Thu Mar > 15 10:33:06 CST 2001 > Charge Total: 20.00 > Time - Sat Jun 29 15:32:19 2002 > Ref# - 12345678 > Appr - APPROVED > Code - 12345612345678 > Err - > Ord# - 12.45.92.15-1025382739-376645-13757-21'; > > > -- > ,-/- __ _ _ $Bill Luebkert ICQ=162126130 > (_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED] > / ) /--< o // // http://dbecoll.tripod.com/ (Free site for Perl) > -/-' /___/_<_</_</_ Castle of Medieval Myth & Magic http://www.todbe.com/ > _______________________________________________ Perl-Win32-Web mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs