Custom Field check on ticket creation error in custom condition - help please

I’m trying to run the following code in my custom condition
#Don’t bother running unless the transaction is a create.
return 0 unless $self->TransactionObj->Type eq “Create”;

#Don’t bother running unless the custom field Urgency is URGENT.
my $CustomFields = $ticket->QueueObj->TicketCustomFields();
while (my $CustomField = $CustomFields->Next()) {
my $nam = $CustomField->Name;
if $ticket->FirstCustomFieldValue($nam) eq “URGENT” {
return 1
return 0

But I get this error logged:
Scrip 12 IsApplicable failed: Global symbol “$ticket” requires explicit package name at (eval 1692) line 5.

I’m obviously not getting the difference between writing a scrip and writing perl code. I’m terribly weak on both. Can someone show me what I’m doing wrong please…

Kevin W. Gagel
Network Administrator
Local 5448
My blog:
My shared files: