0
votes

Consider the following perl code:

#!/usr/bin/perl
use DBD::mysql;
use Data::Dumper;
$dbh = DBI->connect('DBI:mysql:database', 'user', 'password') or die "Can't connect to MySQL";
$sql = "SELECT OdL_ID FROM OdLs LIMIT 1";
$OdL_ID = $dbh->selectrow_array($sql);
print Data::Dumper->Dump([$OdL_ID]);

On my "old" SLES 11 SP4 it returns: $VAR1 = '386379';

On my "new" openSUSE Leap 15.3 it returns: $VAR1 = 386379;

How can I force my "new" openSUSE Leap 15.3 to return a string and not an integer ? Note that I have a lot of perl scripts that have this problem !!

regards Miche

Can you explain why this is a problem for you? In what way does your code not work? minimal reproducible exampletoolic
Please read perlnumber and particularly Numeric operators and numeric conversions. Perl uses that representation of the number which best fit for current operation. Note: in your code it is sufficient to use print Dumper($OdL_ID);.Polar Bear
$dbh->selectrow_array($sql) + 0 if the distinction really matters? It usually doesn't as already mentioned.Shawn