in reply to Variable blasphemy

I tried to reproduce this, but I don't get the same output. I have run your script as provided. (Only change: I converted the EOLs to UNIX-style.)

$ cat test.csv 
rs6413438,CYP2C19_10
rs4986910,CYP2C19_20

running your script yields

Converting specified Star Designations to SNPs...
--------- Converting Star Allele references to rs numbers ---------
Current input line is 
Index 0 is rs6413438
Index 0 is rs6413438 is stored as rs6413438
Index 1 is CYP2C19_10
Index 1 is CYP2C19_10 is stored as CYP2C19_10
Comparing CYP2C19_10 and CYP2C19_10
1. rs6413438 was converted from CYP2C19_10
2. CYP2C19_10 was converted to rs6413438
3. CYP2C19_10 was converted to rs6413438
4. rs6413438 was converted from CYP2C19_10
Current input line is 
Index 0 is rs4986910
Index 0 is rs4986910 is stored as rs4986910
Index 1 is CYP2C19_20
Index 1 is CYP2C19_20 is stored as CYP2C19_20
Comparing CYP2C19_20 and CYP2C19_12
-------------- Done converting Star Allele references -------------
I do NOT get this output:
Index 1 is CYP2C19_10

is stored as CYP2C19_10

There seem to be some unexpected line breaks - this smells like a 'needs a chomp', but you already do that. Maybe you should have a second look at your csv input file?

btw. there is a bug and 2 style problems in your code

Bug: 'Current input line is ' does not actually print the line

- say "Current input line is @_"; + say "Current input line is $_";

Style problem 1 - no need to explicitely refer to $_

- @tmpConv = split ",",$_; + @tmpConv = split ",";

Style problem 2 - variable scoping

replace

my $tmpStar; my $tmpRS; my @tmpConv; while (<$STARFile>){ [...] @tmpConv = split ",",$_; $tmpStar = $tmpConv [1]; $tmpRS = $tmpConv[0];
with
while (<$STARFile>){ [...] my ($tmpRS, $tmpStar) = split ",";

Replies are listed 'Best First'.
Re^2: Variable blasphemy
by SixTheCat (Novice) on Jul 24, 2015 at 15:52 UTC
    poj identified the problem. It was something about the csv file having been made under windows. It works great now =D