skip to main | skip to sidebar

Perl - Tidings

Wednesday, September 14, 2011

How do you know the reference of a variable whether it is a reference,scaller, hash or array?

Answer : There is a 'ref' function .

Perl provides the ref() function so that you can check the reference type before dereferencing a reference

The ref() function can return are:

Function CallReturn Value
ref( 10 );undefined
ref( \10);SCALAR
ref( \{1 => ; "Joe"} );HASH
ref(\&firstSub );CODE
ref( \\10);REF


Posted by Sakthi at 8:42 PM
Labels: Perl Interview Questions

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

My Archive

  • ►  2012 (2)
    • ►  May (2)
  • ▼  2011 (13)
    • ▼  September (13)
      • The caller() function and $wantarray
      • Using the caller() Function in Subroutines
      • Implied Arguments in perl
      • what is it meants by '$_'?
      • Difference between 'my' and 'local' variable scope...
      • what is meant by a 'pack' in perl?
      • How to substitute a particular string in a file co...
      • how do you check the return code of system call?
      • What is '->' in Perl?
      • Difference between 'chomp' and 'chop'?
      • Diffrence between 'use' and 'require' function?
      • How do you know the reference of a variable whethe...
      • Meaning of i and g in Oracle 9i & 10g
  • ►  2010 (8)
    • ►  September (1)
    • ►  August (5)
    • ►  March (1)
    • ►  February (1)
  • ►  2009 (24)
    • ►  July (4)
    • ►  March (11)
    • ►  February (9)
  • ►  2008 (2)
    • ►  November (1)
    • ►  May (1)
  • ►  2007 (1)
    • ►  June (1)