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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner: Re: [regex2012] How do I send output of print statement to array: Edit Log

Chris Charley

Feb 17, 2016, 4:00 PM

Views: 2375
Re: [regex2012] How do I send output of print statement to array

Your print is printing lines that have been seen before. Would you like an array containing ('a line', 'another line', 'a line', 'a line', 'seen before', 'another line')?

I think that you should get the same results by pushing to an array as the print statement.

push my @array, $_ if defined $duplicates{$_};
print "@array";

Should be equal to

print if defined $duplicates{$_};

(This post was edited by Chris Charley on Feb 17, 2016, 4:06 PM)

Edit Log:
Post edited by Chris Charley (User) on Feb 17, 2016, 4:06 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