in reply to Re^2: using Getopt::Long
in thread using Getopt::Long

Did you try it? Would trying it take longer than typing a reply to ask a question, then waiting for answers, then trying it anyway? You're using Perl right? You are supposed to be lazy. Lazy is doing the least work. In this case trying it yourself is the least work by far.

Premature optimization is the root of all job security

Replies are listed 'Best First'.
Re^4: using Getopt::Long
by v15 (Sexton) on Sep 27, 2016 at 20:04 UTC
    GetOptions( 'u|unique' => \my $unique, ); open F,'/Users/gupta567varun/Desktop/AAC_SJ.out.tab',or die $!; while(<F>){ chomp; my @s = split /\t/,$_; my $count = $s[6]; if($count > $unique){ print $_,"\n"; } } close F;
    Thanks for pointing me out the documentation. What is wrong here in the code. I ran it like this perl script.pl -u 4 , but it still prints lines less than 4?? EDIT:
    #!/usr/bin/perl-w use strict; use warnings; use Getopt::Long; GetOptions( 'uniq=i' => \my $unique, ); while(<>){ chomp; my @s = split /\t/,$_; my $count = $s[6]; if($count > $unique){ print $_,"\n"; } }
    Running the script as

    perl script.pl --uniq 4 file.txt

    Works now!! Thanks