in reply to File to @array then parse like a file
-Robert#!/usr/bin/perl -w use strict; my $file = 'c:\\path\\file.name'; open FILE, "$file" or die "Couldnt open file:$!\n"; my @info = <FILE>; close FILE; my ($server,$client); for(@info){ chomp; if(/Job server:+[\W]+(.*)/){ $server = $1; } if(/Job name:+[\W]+(.*)/){ $client = $1; $client =~ s/-.*//; print "$client is on $server\n"; } }
|
|---|