Want more features on Pastebin? Sign Up, it's FREE!
Guest

Use of undef in perl

By: a guest on May 18th, 2011  |  syntax: Perl  |  size: 0.25 KB  |  views: 89  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. $foo = 10;
  2.  
  3. if ($foo == undef) {
  4.     printf("foo : It's undefined");
  5. } else {
  6.     printf("foo : It's defined");
  7. }
  8.  
  9. printf("\n");
  10.  
  11. if ($bar == undef) {
  12.     printf("bar : It's undefined");
  13. } else {
  14.     printf("bar : It's defined");
  15. }
clone this paste RAW Paste Data