Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

parsing

by amoura (Initiate)
on Jul 11, 2002 at 14:28 UTC ( [id://181028]=perlquestion: print w/replies, xml ) Need Help??

amoura has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: parsing
by helgi (Hermit) on Jul 11, 2002 at 15:13 UTC

    Fellow Perlmonks.

    This person has been asking this question over and over and over again in comp.lang.perl.misc, alt.perl and probably in other places, including here. S/he posts under various names including Sami and Sara. She has received a number of useful answers as well as requests for further info, but never answers them, just keeps posting the same question over and over (and over) again. I suggest you ignore him/her.

    Regards,
    Helgi Briem
      On PerlMonks this person appears as sara, DS, splitOnce, and amoura, and perhaps others. Maybe PerlMonks will soon be earning some credits towards a CS degree.

      bassplayer

Re: parsing
by Abigail-II (Bishop) on Jul 11, 2002 at 14:46 UTC
    Why are you doing all the juggling with @hold1 if you are going to bail out after the first hit anyway? Why not something like:
    open my $fh => "$tempDir/nbssbaseblds.txt" or die "Open failed: $! +\n"; while (<$fh>) { my @parts = split m :/: => (split m /:/) [0]; # Split into pat +h names. if ($parts [-1] =~ /^\w+\.bld$/) # Match on file +name. ... whatever ... # $parts [-3] eq + "acn" last; } }

    Abigail

Re: parsing
by bjelli (Pilgrim) on Jul 11, 2002 at 14:45 UTC

    After your loop the last line read is still in $_, so you can use

    @path = split(/\//, $_); $importantdir = $path[-3];

    the negative index in the array counts from the end of the array rather than the beginning.

    --
    Brigitte    'I never met a chocolate I didnt like'    Jellinek
    http://www.horus.com/~bjelli/         http://perlwelt.horus.at
Re: parsing
by bronto (Priest) on Jul 11, 2002 at 16:48 UTC

    You here again? Again with a question with this script?

    Are you trying to learn Perl or are you trying to make us write the code you are supposed to write?

    I never refuse a reply, even on trivial questions, but you seem to lack on education IMHO

    --bronto

    # Another Perl edition of a song:
    # The End, by The Beatles
    END {
      $you->take($love) eq $you->made($love) ;
    }

    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-19 20:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found