Can I place a FILE into an @array and parse it for information..? Would it be faster than just parsing a file..? I am starting with somthing like this code sample listed below...


Thank's Darrick...

$logfile = 'c:\\path\\file.name'; # Ascii txt file

open(FILE, "$logfile"); # open logfile for reading
   @txtfile = <FILE>;
  close(FILE);
   foreach $txtline(@txtfile) {
##### Get Server Variable #####
   if ($txtline =~ /\bJob server:/) {
    chomp ($server = $txtline);
   $server =~ s/Job server: //;
   }
##### Get Client Variable ####
   if ($txtline =~ /\bJob name:/) {
    chomp ($client = $txtline);
    $client =~ s/Job name: //;
    $client =~ s/ -.*//;
   }
 }
print "$client is backed up on $server"; # just an example but you get the point

listed Below is a small example of the txt file I am parsing

======================================================================
Job server: Some_Server
Job name: Some_Client - INC
Job started: Monday, March 10, 2003 at 9:30:02 PM
Job type: Backup
Log file: BEX78.txt
======================================================================


In reply to File to @array then parse like a file by dbrock

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.