If you have more extensive processing than shown it may be worth considering using DBD::AnyData to wrap your file as a database.

use strict; use warnings; use DBI; my $dbh = DBI->connect ('dbi:AnyData(RaiseError=>1):'); $dbh->func ( 'Docs', 'Fixed', [<DATA>], { col_names => 'name,batch,file,size,date,status,owner', pattern => 'A16 A14 A26 A15 A25 A15 A9' }, 'ad_import' ); my $sql = 'SELECT name, batch, file FROM Docs order by name, batch'; my $sth = $dbh->prepare ($sql); $sth->execute (); while (my $row = $sth->fetchrow_hashref ()) { print "$row->{name} has '$row->{file}' and BatchID is $row->{batch +}\n"; } __DATA__

Given data as shown in the OP prints:

user1 has 'New Microsoft Word Docu' and BatchID is 1712 user1 has 'MIGRATE.DLL.698' and BatchID is 1715 user1 has 'test2.txt.542' and BatchID is 1718 user2 has 'amanda test 1 .doc.55' and BatchID is 1705 user2 has 'amanda test 1 .doc.544' and BatchID is 1706 user2 has 'amanda test 1 .doc.411' and BatchID is 1707 user3 has 'amanda test 2.doc.829' and BatchID is 1699 user3 has 'amanda test 2 .doc.610' and BatchID is 1701 user3 has 'amanda test 2 .doc.322' and BatchID is 1702

To use a file instead of data provided in __DATA__ replace [<DATA>] with the file name and 'ad_import' with 'ad_catalog'.

True laziness is hard work

In reply to Re: read the filename column by GrandFather
in thread read the filename column by roadtest

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.