On Apr 22, 2012, at 9:52 AM, lina wrote: Here is what I Have came up so far, > > #!/usr/bin/env perl > > use strict; > use warnings; > use autodie qw(open close); > use 5.012; > > my $dict = system("tail -n 1 text_1.xvg");
Read the documentation on the system function. It does not return the output of the child process to your program. For that, you need the qx() operator, or backticks: my $dict = qx("tail -n 1 text_1.xvg"); > print $dict; > print "\n\n"; > open my $fh, "<","text_2.xvg"; > while(<$fh>){ > print $_; > } Of course, it is possible to read the last line of a file without resorting to creating a child process. See, for example, the module File::ReadBackwards. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/