Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Perl
Perl Misc
Walking a tree and extracting info... Problems
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Tad McClellan, post: 4813502"] You should have a look at the Posting Guidelines that are posted here frequently (even though you have composed a very good first post). Putting the lines from the 1st file into @lines, then tacking on the lines from the 2nd file, then the 3rd ... #!/usr/bin/perl use warnings; use strict; my $dir = '/Users/test/'; Since you want a new @lines array for every iteration of this loop, and since you will now be using "strict" forevermore <g>, put a declaration here so that you will get a new @lines array each time through the foreach loop: my @lines; If you do it this way instead: next if ($file eq ".") || ($file eq "..") || ($file eq ".DS_Store"); then you can save a level of indent. You eventually push() all of the lines from all of the files into @lines. (the matching line from file 1 is in there every time.) This adds space characters between each line. Is that want you wanted? You should never use the dollar-digit variables unless you have first tested to ensure that the match _succeeded_ if ( $string =~ /<span class=searchtitle><B> (.*?)<\/B><\/span><BR>/is ){ print "$1\n"; # print html page title } ^ ^ ^ Is there really a space there in the string you are matching against? [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Perl
Perl Misc
Walking a tree and extracting info... Problems
Top