in reply to problem with variables

You should show some minimal example exhibiting the problem. It just shouldn't be so:
$ perl -le 'print $ARGV[0]==$ARGV[1] ? "ok" : "no"' 23465993.9380 2346 +5993.938 ok
But chances are that perldoc -q 'long decimals' from the faq may be of some interest to you.

Incidentally, you shouldn't use $a and $b as general purpose variables, as this may interfere with sort.

Replies are listed 'Best First'.
Re^2: problem with variables
by jeanluca (Deacon) on Oct 19, 2005 at 08:46 UTC
    Ok, you aksed for it, @res is the array with hashes and ... represents a very long unique key. What happens here: $row contains a starttime and endtime. What I try to ckeck for is if there are gaps in time between the rows:
    foreach $row (@res) { if(defined $merge->{...} ) { if ( $merge->{...}->{next_samp} == $row->{starttime}) { $merge->{...}->{endtime} = $row->{endtime} ; $merge->{...}->{next_samp} = $row->{endtime} + 1./ +$row->{srate} ; } else { delete $merge->{...}->{next_samp} ; $dummy[++$#dummy] = $merge->{...} ; $merge->{ ...} = $row ; $merge->{...}->{next_samp} = $row->{endtime} + 1./ +$row->{srate} ; } } else { $merge->{ ...} = $row ; $merge->{...}->{next_samp} = $row->{endtime} + 1./$row +->{srate} ; } }
      Well, it seems that in the meanwhile you have solved your problem. My point was about preparing a suitable complete but minimal example still exhibiting the problem. This is a general recommendation as to how to ask for help, and sometimes it's hard or even impossible to do, but that's rare. More commonly it even happens that while doing so one will find the answer to his own question.

      Now, as side notes to comment you code:

      • I wouldn't use all those nested if's; I'd recommend you to read up something about next, last and while you're there also redo,
      • I wouldn't assign to $dummy[++$#dummy], but stick with push, since it's what it's actually for.