Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^3: rename duplicate data

by ww (Bishop)
on Jun 22, 2012 at 16:09 UTC ( #977870=note: print w/replies, xml ) Need Help??

in reply to Re^2: rename duplicate data
in thread rename duplicate data

Continuing with the issues and advice:

Please surround your code and data listings with <c> (at the beginning) and </c> (at the end). It makes your nodes much easier to read, and thus, more likely to draw help.

Your indentation style may have been different, but surely you saw that your code didn't look 'right' (for some value of 'right' meaning 'easy to read'):

#!/usr/bin/perl; use strict; use warnings; my $filename = $ARGV[0]; my $debug = $ARGV1; die "\n\tUSAGE: perl $0 output debug\n\n" unless $ARGV[0]; die "\n\tERROR: Cannot find the file $ARGV[0]\n\n" unless -e $ARGV[0]; + open(IN,$filename); my $ids; while($filename){ chomp; if(/(ID=.+)$/){ if(++$ids{$1} > 1){ say $_, $ids{$1}; next; } } say; } print say;

The say in Line 18 probably doesn't do what you intended; print say; in Line 20 is meaningless.

say is "Just like "print", but implicitly appends a newline" to quote the 5.014 doc. To use it, either include use 5.010 (or higher; 5.016 is current) as monsoon suggested or use feature qw(switch say); (where feature is a (relatively new) pragma to enable new features that are not available without specifically enabling them).

Other issues start with the unnecessary (but harmless) semi-colon at the end of the hashbang (or, in order of severity, your incorrect attempt to invoke debug mode, as noted by monsoon.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://977870]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2017-02-23 02:55 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (338 votes). Check out past polls.