: : I'm pretty sure your $data[3]-- is the problem. If you want to remove the \n, you should use:-
: :
: : chomp $data[3];
: : print $data[3];
: :
:
: Hmm, when I use chomp $data[3], and I do print $data[3]; then print "show" nothing.. :/
:
: : Also note you actually end up executing $data[3]-- twice, which I expect is not what you want it to do. So, get rid of the --'s and do chomp $data[3];
:
: I use ($data[3]--) beacuse, I use many combination with this.. beacuse
: I don't have ideas, why this code not work correctly..
Yes, but -- is for decrementing numbers.
$a = 3;
$a--;
print $a; # Prints 2
You seem to want to remove characters from a string using it. No, that's not what it's for. Your code won't work if that's what you're trying to do.
: In that code, I do lentgh ($data[3]), and length ($compare[0]), and He show is len $data[3] = 7, and len $compare[0] = 5, but
: $data[3] = !help so 7 also with '\n', not 6 ? ee ? why ?
: $compare[0] = !help <- 5
:
I would guess it is 7 because some platforms have \r and \n, e.g. two end of line characters. You may need to use chomp twice, or altenatively do:-
$data[3] =~ s/\r|\n//g;
But two chomps are more efficient. Either are better than --, which is just...well...wrong.
Jonathan
###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");