Tuesday, June 5, 2012

Calculating sum of Array elements in Perl

@array1 = `cat filename | grep Numeric_String_Value`;
$Total += $_ for @array1;
print "Total sum of Array values is $Total \n";

No comments:

Post a Comment

Popular Posts

About Me

My photo
I have started this blog to share my work experience and spread some smart solutions on Linux to Internet community. I'm hoping more people will get benefited from this blog. Brief about me: I have 14+ years experience working as System Admin and currently work with VMware.