in reply to 1 vs "1"

It sounds like you're trying to do something in C, not Perl. If the string you're passing is an integer, then it's an integer, not a string!

I'm not trying to be dense, but that's the way Perl looks at things. If you want to pass integers in, but treat them as strings, the easiest way I can think of it to pass a second variable in that would tell you if this scalar is to be viewed as an integer or string.

Of course, I would personally write two functions, one for integers and one for strings. Then, you decide outside the function which to do. Right now, you've got a function doing two different things. Make each do one thing and one thing well.

You can tell this really easily if your function has the form:

sub foo { my ($a, $b, $c) = @_; if ($a == 1) { # Do something } else { # Do something else } }

We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.