CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [mar85] Need Help in Report File Handling: Edit Log



mar85
Novice

Apr 9, 2013, 10:30 PM


Views: 414
Re: [mar85] Need Help in Report File Handling

This is the body of my script right now:


Code
use Getopt::Long; 

GetOptions(
"txt_path:s" => \$txt,
"output_txt_path:s" => \$out_txt
);

chomp($txt);
chomp($out_txt);
$out_txt =~ s/^\s+//; #remove leading spaces
$out_txt =~ s/\s+$//; #remove trailing spaces

open(IN_TEXT,$txt);
my @txt_contents = <IN_TEXT>;
close(IN_TEXT);

foreach (@txt_contents) {
if ( $_ =~ m/FRUITS/g) {
my $filtered_content = custom_subroutine($_);
push(@Sorted_Content,$filtered_content);
}
}

open(IN_OUTPUT_FILE,">$out_txt.txt");
foreach (@Sorted_Content)
{
print IN_OUTPUT_FILE;
}



(This post was edited by mar85 on Apr 9, 2013, 10:32 PM)


Edit Log:
Post edited by mar85 (Novice) on Apr 9, 2013, 10:32 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives