Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: using Getopt::Long

by v15 (Sexton)
on Sep 27, 2016 at 20:04 UTC ( [id://1172778]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1172778]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-26 00:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found