programming-examples/perl/File/Split a file handle containing array.pl

17 lines
278 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
@a1 = (1, 2, 3);
open FILEHANDLE, ">array.dat" or die "Can not open array.dat";
print FILEHANDLE "@a1";
close FILEHANDLE;
open FILEHANDLE2, "<array.dat" or die "Can not open array.dat";
@a2 = split(" ", <FILEHANDLE2>);
print "@a2";
close FILEHANDLE2;