Perl how to read a line from a file handle that is an array element

后端 未结 3 1891
忘了有多久
忘了有多久 2021-01-22 17:42

My perl script takes any number of files, opens them, and reads one line from each. But it\'s not working. Here\'s my code.

#!/bin/perl
$numfile = scalar @ARGV         


        
3条回答
  •  余生分开走
    2021-01-22 18:44

    Use readline instead of <>.

    perlop says:

    If what's within the angle brackets is neither a filehandle nor a simple scalar variable containing a filehandle name, typeglob, or typeglob reference, it is interpreted as a filename pattern to be globbed

提交回复
热议问题