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

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