See perlintro. The following is almost entirely copied from that page, I've just added the chomp to remove the newlines and customized the print:
#!/usr/bin/env perl use strict; use warnings; open(my $in, "<", "input.txt") or die "Can't open input.txt: $!"; chomp( my @lines = <$in> ); close $in or die "$in: $!"; print "Line 1: $lines[0]\n"; print "Line 2: $lines[1]\n";
In reply to Re: Multi line file to variables
by Anonymous Monk
in thread Multi line file to variables
by jackierobs12
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |