Try the following Code Snip:

my @cmd = `java SSLTest`;
my %hash;

chomp @cmd;
foreach (@cmd) {
        if (/ - /) {
                ($key, $value) = split(/ - /);
                $hash{$key} = $value;
                }
        if (/: /) {
                ($key, $value) = split(/: /);
                $hash{$key} =  $value;
                }
        }


------------------------------
James Schappet
Schappet.com


On Sun, 23 Jun 2002, karthikeyan wrote:

> Dear All,
>
>   Hope you are all having a great day.
>
>   I have a problem.  I m running a java program through perl like this :
>
>   $cmd = 'java SSLTest';
>
>   It returns output like this :
>
>   Using ClearCommerce SSL Java API Version: release-3-8-3-17 Shipping: 10.0 Tax: 0.0 
>Time - Sat Jun 22 07:28:42 2002 Ref# - 12345678 Appr - APPROVED Code - 123456 AVSCode 
>-  PayServ -  Err  -  Ord# - 12.45.92.15-1024748922-901932-1575-14
>
>   when you run the program in the command line mode I would get something like this 
>so that you don't get confused
>
> Using ClearCommerce SSL Java API Version: release-3-8-3-17
>
> Shipping: 10.0
> Tax: 0.0
> Time - Sat Jun 22 07:28:42 2002
> Ref# - 12345678
> Appr - APPROVED
> Code - 123456
> AVSCode -
> PayServ -
> Err  -
> Ord# - 12.45.92.15-1024748922-901932-1575-14
>
>   Now what I want to do here is get each name and value in a separate separate 
>variable like :
>
>   $Shipping  will contain 10.0, $Tax will contain 0.0, $Time will contain Sat Jun 22 
>07:28:42 2002
>
>   how do I parse those string and store it in a variable.
>
>   Any help regarding this would be greatly appreciated.
>
>   Have a great day.
>
> karthikeyan.
> 
>-------------------------------------------------------------------------------------------------------------
> Judge not, that ye be not Judged - Abraham Lincoln's favorite quote
> 
>-------------------------------------------------------------------------------------------------------------
>

_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to