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: [pbhuter] Array Returns Multiple Values: Edit Log



hwnd
User

May 21, 2013, 7:53 AM


Views: 1057
Re: [pbhuter] Array Returns Multiple Values

Try this:


Code
myfile.txt  


000000000: words, wordsID: 1234
000000000: words, wordsTime: 1234567



Code
 my @wanted;   

open my $fh, '<', 'myfile.txt' or die "failed: $!";

while ( my $line = <$fh> ) {
chomp $line;
my ($time) = $line =~ /\s.+?(\d+)/g;
$time =~ s/\r\n$//g;
push @wanted, $time;
}

my $outString = join " ", @wanted;
print $outString, "\n";




Code
__OUTPUT__ 
1234 1234567



(This post was edited by hwnd on May 21, 2013, 7:59 AM)


Edit Log:
Post edited by hwnd (User) on May 21, 2013, 7:55 AM
Post edited by hwnd (User) on May 21, 2013, 7:59 AM


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

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