in reply to Re: get a text out from a string
in thread get a text out from a string

What's wrong with a conditional statement? And what should happen to $productcode if it doesn'T start witch FCL?

You can do something like this:

$productcode = $productcode =~ m/^FCL/ ? : 'FCL' : "No, sorry";
But that only hides the conditional in the ternary operator. And you can use parenthesis in the regex and access the matched value with $1, but you still need a conditional somewhere to check its value.