Thanks
On 8 Feb 2013 07:37, "shawn wilson" wrote:
>
> How do I take in a file or pipe input?
Please check this
http://perldoc.perl.org/functions/open.html
What I want is:
> script.pl file.txt
> or
> cat file.txt | script.pl
>
> What I'm trying is:
> my $logfile;
> if (@ARGV and $ARGV[0] =~ /^-.
> On Fri, Feb 8, 2013 at 2:06 AM, Jim Gibson wrote:
>>
>> The null filehandle (<>) will read from standard input if @ARGV is empty,
>> and from the members of @ARGV, interpreting each scalar as a file name to be
>> opened automatically in succession.
>>
>> Does that do what you want?
>>
>>
Act
Ah, yeah that'll work. I can just set a count and
die "blah" if $count == 0;
Didn't think I could do that with a diamond.
Thanks
On Fri, Feb 8, 2013 at 2:06 AM, Jim Gibson wrote:
>
> On Feb 7, 2013, at 10:34 PM, shawn wilson wrote:
>
>> How do I take in a file or pipe input? What I want is:
>> s
On Feb 7, 2013, at 10:34 PM, shawn wilson wrote:
> How do I take in a file or pipe input? What I want is:
> script.pl file.txt
> or
> cat file.txt | script.pl
>
> What I'm trying is:
> my $logfile;
> if (@ARGV and $ARGV[0] =~ /^-./) {
> open($logfile, '<', $ARGV[0]);
> } elsif (-t STDIN and not
How do I take in a file or pipe input? What I want is:
script.pl file.txt
or
cat file.txt | script.pl
What I'm trying is:
my $logfile;
if (@ARGV and $ARGV[0] =~ /^-./) {
open($logfile, '<', $ARGV[0]);
} elsif (-t STDIN and not @ARGV) {
$logfile = ;
} else {
doe "no data"
}
PS - I want to av