LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-20-2006, 12:00 PM   #1
ryedunn
Member
 
Registered: Jul 2003
Location: Chicago
Distribution: Fedora, ubuntu
Posts: 459

Rep: Reputation: 30
Perl forcing loop to next b4 first job is done.


I have an array of files which loops though them grabbing relevant data and creating a new file for each. These files are very big and Im curious if you can force perl to process more than one (or all) at the same time.
Code:
@Files = ("file1", "file2", "file3");

foreach $File (@Files) {
  open(INFILE, $File) or die "Can't open source file: $File \n";
  open(OUTFILE, "> $File.good") or die "Can't open '$File.good' file \n";

  while (<INFILE>) {    
    @fields = split /\|/, $_;
    
    if ( $fields[0] <= $FooBar ) { 
      print OUTFILE $_;
    }
  }
}
Thank you.
 
Old 09-20-2006, 01:14 PM   #2
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
You can use threads, see http://perldoc.perl.org/perlthrtut.html.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
perl loop jazman Programming 3 07-05-2006 10:31 AM
Perl: Where am I in a foreach loop? jrtayloriv Programming 3 01-30-2005 10:43 PM
loop through string with perl lfur Programming 2 07-03-2004 08:05 AM
Need help with perl loop! morbid_ru Programming 1 02-24-2004 01:14 PM
Need help with perl loop! morbid_ru Programming 2 02-17-2004 05:15 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration