Search notes:

Perl module Scalar::Util

use warnings;
use strict;

use Scalar::Util qw(blessed dualvar isdual readonly refaddr reftype tainted weaken isweak isvstring looks_like_number set_prototype);


my $dual  = dualvar 10, "foo";
print "is_dual: " . (isdual $dual) . "\n";

print "\n---- looks_like_number:\n";

for my $uncertain (  
      10,               # yes
     'twenty',          # no
     " 30 ",            # yes (note the whitespaces)
      40.5,             # yes
     "000047",          # yes
     -55.49,            # yes
     "   -72.3 ",       # yes
     "  - 63.1 ",       # no
     "20e3",            # yes
     "  20e3  ",        # yes
     "  20 e3  ",       # no
     "1_111_111",       # no
     " -+-77"           # no
  ) {

  if (looks_like_number($uncertain)) {
    printf "  %-15s looks like a number\n", ">$uncertain<";
  }
  else {
    printf "  %-15s doesn't look like a number\n", ">$uncertain<";
  }
}
Github repository PerlModules, path: /Scalar/Util/script.pl

reftype

#
#   Compare with ref() : ( https://github.com/ReneNyffenegger/about-perl/blob/master/functions/ref.pl )
#
use warnings;
use strict;
use feature 'say';

use Scalar::Util qw(reftype);

my $h = bless {}, 'Some::Foo';
my $s = 'scalar';

say ref($h);
# Some::FOO

say reftype($h);
# HASH

if (defined reftype($s)) {
  say reftype($s);
}
else {
  say 'reftype($s) is not defined';
}
# reftype($s) is not defined
Github repository PerlModules, path: /Scalar/Util/reftype.pl
See also Perl function ref()

See also

Perl modules.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1744800101, '13.58.119.156', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Perl/modules/Scalar/Util/index(105): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78