Convert open(IN, file) to memory/array instead of using pre-existing files

I'd like to take the following scripts and combine them, as well as change the behaviour slightly. Instead of the data being parsed/matched from pre-existing files, I'd like to SNMPWALK the data, place it in memory, then do the parsing/matching of that data, and then write that data to disk and or a MySql DB.

This is basically the script I want to change, again instead of reading in files, read in data stored in memory from a snmpwalk...
http://www.experts-exchange.com/Programming/Programming_Languages/Perl/Q_21850595.html#16682292

So we'd do a snmpwalk to get the data, then store to memory (not sure how to really) I'm not sure the best way to walk via perl. Currently I have a cron job that simply runs a shell script to dump the data to directories like this:
snmpwalk -v 2c -c Public -O n device.example.com .1.3.6.1.2.1.17.4.3.1.1 >file1.txt
snmpwalk -v 2c -c Public -O n device.example.com .1.3.6.1.2.1.17.4.3.1.2 >file2.txt
snmpwalk -v 2c -c Public -O n device.example.com .1.3.6.1.2.1.17.1.4.1.2 >file3.txt
snmpwalk -v 2c -c Public -O n device.example.com .1.3.6.1.2.1.31.1.1.1.1 >file4.txt
snmpwalk -v 2c -c Public -O n device.example.com .1.3.6.1.2.1.4.22.1.2 >file5.txt

Then after that cron job completes, I run the script in the above link to match/aggregate the data together for each interface, and it writes that file to disk. I'd like to run the 5 snmpwalks above, then parse that data together and wite it to disk, or even more preferred is to a mysql table.
Thanks!
-rich
LVL 38
Rich RumbleSecurity SamuraiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
@result = `snmpwalk -v 2c -c Public -O n device.example.com .1.3.6.1.2.1.17.4.3.1.1`;
ozoCommented:
for my $f( qw(  .1.3.6.1.2.1.17.4.3.1.1  .1.3.6.1.2.1.17.4.3.1.2  .1.3.6.1.2.1.17.1.4.1.2 .1.3.6.1.2.1.31.1.1.1.1 .1.3.6.1.2.1.4.22.1.2 ) ){
  open F,"snmpwalk -v 2c -c Public -O n device.example.com $f |" or warn $!;
  push @File,{};
  while( <F> ){  
     if( /\Q$f\E([\d\.]+)\s*=\s*INTEGER:\s*(\d+)/ ){
          $File[-1]{$1}=$2;
     }
  }
}

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rich RumbleSecurity SamuraiAuthor Commented:
that works very well, thanks!
-rich
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.