1 / 9

Programming in Perl Introduction

Programming in Perl Introduction. Peter Verhás January 2002. Hello Word. print ” Hello World!”; It is that simple just like BASIC!. Perl is an interpreted language. Program is text file Perl loads it, compiles into internal form Executes the intermediate code. Hello World # 2.

Download Presentation

Programming in Perl Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programming in PerlIntroduction Peter Verhás January 2002.

  2. Hello Word print ”Hello World!”; It is that simple just like BASIC!

  3. Perl is an interpreted language • Program is text file • Perl loads it, compiles into internal form • Executes the intermediate code

  4. Hello World # 2 $a = 123; $b = 55; $c = $a + $b; $d = "kakukk\n"; $d = 'kakukk\n' if $c == 178; if( $d eq "kakukk\n" ){ print "Hello World!\n"; }else{ print "This is not a good day!\n"; } OUTPUT: This is not a good day!

  5. Variables $a = 123; $b = 55; $c = $a + $b; $d = "kakukk\n"; $d = 'kakukk\n' if $c == 178; if( $d eq "kakukk\n" ){ print "Hello World!\n"; }else{ print "This is not a good day!\n"; } • Variables start with $ • There is nothing like reserved words • $else $if $while are good variables

  6. Strings $a = 123; $b = 55; $c = $a + $b; $d = "kakukk\n"; $d = 'kakukk\n' if $c == 178; if( $d eq "kakukk\n" ){ print "Hello World!\n"; }else{ print "This is not a good day!\n"; } • ”kakukk\n” is interpolated string • ’kakukk\n’ is NOT interpolated, 8 characters

  7. Numbers $n = 1234; # decimal integer $n = 0b1110011; # binary integer $n = 01234; # octal integer $n = 0x1234; # hexadecimal integer $n = 12.34e-56; # exponential notation $n = "-12.34e56"; # number specified as a string $n = "1234"; # number specified as a string

  8. This program is a liar $a = 123; $b = 55; $c = $a + $b; $d = "kakukk\n"; $d = 'kakukk\n' if $c == 178; if( $d eq "kakukk\n" ){ print "Hello World!\n"; }else{ print "This is not a good day!\n"; } • It prints This is not a good day! • which is actually not true, is it?

  9. Thank you for your kind attention.

More Related