in reply to Bad Code?

I read your code and it seems fine, not that I'd be able to discern between appallingly awful code and tremendously great code...

There are however a couple changes I'd make : first off, I'd use the pragma use strict; at the very beginning of your code - it then forces you to declare your variables the following way : my $a; or my $a = 17;...
It prevents you from mixing up eponymous variables specially when you go into loops.

Second of all, before even testing the number, I'd initialize ask for it... :
my $guess = 0; # can't be the right one then until($guess == $secret_number) { $guess = <STDIN>; # do the rest }
Hence the if (defined $guess is useless and you can directly write :
my $answer = ($guess>$secret_number?("bigger than"):($guess<$secret_number?("smaller than"):""))
I note that you've used eq : this is a string comparison tool. It's best you use == (as in C). On second thoughts, I've noticed you're using eq because of $guess = <STDIN> in which case you're right eq is better...

Lastly, instead of using $quit as a string which then makes you use regexes, you'd be better off using a byte : $quit = 1; or even a constant : $quit = YES provided you previouslt declared YES : use constant YES => 1...

Hope this helps...