Storing texts from many files in an array using foreach Perl

sub open_file {
    my @files = @_;
    my @file_text = ();

    foreach my $file(@files){
        open(my $fh, '<', "./DATA/" . $file) or die "can't open $file: $!";
        @file_text = <$fh>;
    print "@file_text";

Having problems concatenating texts from 3 different .html files into one array @file_text

So far the script only stores the text into @file_text from the very last .html file it loops through.


Of course, as you erase the last value of @file_text each time with the line

@file_text = <$fh>;

you should replace this line with

push (@file_text, <$fh>);

Need Your Help

generics and interfaces enumeration

c# .net generics interface ienumerable

If have a set of classes that all implement an interface.

Order list by parent and child items

c# .net linq

I have a list of products that have to be ordered by parent then all children of that parent, then next parent, etc.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.