[EMAIL PROTECTED] wrote:
> Wags,
> 
> come on.... you did not answer all my questions???  What about
        I answered what I could. So is this what you want:
62622 62622
62535 87

where the code looks like:

#!perl

use strict;
use warnings;

my $diff=0;
my $MyMult = 1;
my $MyId;

while (<DATA>) {
     if ( /(regular files|archdone files)/ ) {
        $MyId = $1;
        $MyMult = 1;
        $MyMult = -1 if ( $MyId =~ /^arch/ );
        
        s/,//;
        
        printf "%s %s\n",
                /\s(\d+)/,
                $diff += $1 * $MyMult;
     }
 }

__DATA__
regular files            62,622    597.488G          641547379187
archdone files           62,535    597.008G          641032761295

        Made minor changes, but is this what you are after?
Wags ;) ps I use printf and I really don't know the answer to + on the split.  
I do know that the $1 was wrong, but .

> 
> I took away the + from the print and I had some errors, why is the +
> infront of the split needed in Perl?
> I looked in my programming perl and could not find it/.
> 
> The reason I want to use split is b/c these numbers change frequently
> and I am guaranteed this "field" as opposed to using a substr the
> starting point of $_ would be 25 and the length would fluctuate.
> 
> yes maybe I am not using split that way it should be, but If my
> delimiter would be anything it would have to be everything between
> \w+ , field 3 or a space.
> 
> I am trying to get the difference between these 2 numbers b/c in the
> ASM env. regular files and archdone files should NEVER get larger
> that say.... 300.
> 
> 
> Can you provide or anyone else provide any more hints?
> 
> thanks,
> 
> 
> Derek B. Smith
> OhioHealth IT
> UNIX / TSM / EDM Teams
> 
> 
> 
> 
> 
>              "Wagner, David
>              --- Senior
>              Programmer                                              
>              To Analyst --- WGO"          <[EMAIL PROTECTED]>,
>              <[EMAIL PROTECTED]         <beginners@perl.org>
>              ight.fedex.com>                                         
> cc 
> 
>              03/11/2005 04:25                                     
>              Subject PM                        RE: print with +split
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> [EMAIL PROTECTED] wrote:
>> All,
>> 
>> Here is my code:
>> use strict;
>> use warnings;
>> my $dev  = qw/original1/;
>> my $dev1 = qw/clinical1/;
>> my $fout = qq(/usr/local/log/fuji.out);
>> 
>>         open (OUT, "+>$fout") || die "unable to open file: $fout $!";
>>         open (FOO, "samcmd a $dev 2>\&1 |" ) || die "unable to open
>>         pipe... $!"; while (<FOO>) {
>>              if (/regular files/ or /archdone files/) {             
>>                 my $diff=0; local $, = "\n";
>>                 s/,//;
>>                 print +(split)[2], $,, $diff-=$1;
>              I think you are mixing your metaphors. $1 is not field 1
> , yes in awk maybe, but for Perl it deals with the ()'s in a regular
> expression so you would need the regular expression to accomplish
> your task. 
> 
> Wags ;)
>>              }
>> 
>> and it prints w/out the $diff code
>> 
>> 62622
>> 
>> 62535
>> 
>> WITH the $diff code it is NOT subtracting the two numbers which is
>> what I need. 
>> 
>> I think the problem is $_ contains data from the original app
>> command which is 
>> 
>> regular files            62,622    597.488G          641547379187
>> archdone files       62,535    597.008G          641032761295
>> 
>> and so I am saying subtract what is in field 1 , well field 1 is
>> empty, but why???? finally, I took away the + from the print and I
>> had some errors, why is the + infront of the split needed in Perl?
>> 
>> thank you,
>> derek
>> 
>> Derek B. Smith
>> OhioHealth IT
>> UNIX / TSM / EDM Teams
> 
> 
> 
> *******************************************************
> This message contains information that is confidential
> and proprietary to FedEx Freight or its affiliates.
> It is intended only for the recipient named and for
> the express purpose(s) described therein.
> Any other use is prohibited.
> *******************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to