Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: File to @array then parse like a file

by blaze (Friar)
on Mar 14, 2003 at 23:39 UTC ( [id://243208]=note: print w/replies, xml ) Need Help??


in reply to File to @array then parse like a file

You could do something like this:
#!/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"; } }
-Robert

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://243208]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-24 06:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found