Ruby for perl developers

  • 437 views
Uploaded on

A short light talk about Ruby for Perl developers. It should be read "as-is" and taken lightly for .

A short light talk about Ruby for Perl developers. It should be read "as-is" and taken lightly for .

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • And Perl also can be readable if you wish too, but you misunderstood the reason I chosen that syntax over the others...

    But it was great doing it even though you made a lot of nitpicking :P
    Are you sure you want to
    Your message goes here
  • Some inaccuracies: Perl has a given/when for switches, and a 'foreach my $i ( 0 .. 99 )' is more Perlish than a C-style for loop, and several other small no-that-important discrepancies.

    It was a fun talk, thanks for doing it! :)
    Are you sure you want to
    Your message goes here
    Be the first to like this
No Downloads

Views

Total Views
437
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
5
Comments
2
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Ruby For Perl Developers
  • 2. What Is Ruby ? A dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.
  • 3. Ah, yes, but what is Ruby, and how it is different then Perl ?
  • 4. puts 'bla' print “blan”
  • 5. puts 'bla' 1.class print “blan” $a=1; print ref $a;
  • 6. puts 'bla' 1.class nil.class = NilClass print “blan” $a=1; print ref $a; undef=undef
  • 7. puts 'bla' 1.class nil.class = NilClass (0..999).each do { |i| … } print “blan” $a=1; print ref $a; undef=undef for (my $i =0; i<=999; i++) ...
  • 8. $global = ... local = ... @instance_var = ... @@class_var = ... CONSTANT = ... ; Constant = ... our $global = ... local $local = ; my $local2 = ; - - -
  • 9. Hash <= v1.8 a = { '22' => 'twenty two' } Hash ... a = { '22' => 'twenty two' }
  • 10. Hash <= v1.8 a = { '22' => 'twenty two' } Hash >= 1.9 (v2.0 development) a = { '22' : 'twenty two' } Hash ... a = { '22' => 'twenty two' }
  • 11. a = case b when /^d+$/ : 'digits' when /^w+$/ 'letters' when /^[a-fd]+$/, /^[A-Fd]+$/ 'hexa' when '1' : 'one' else b.class end use Switch; switch ($b) { case /^d+$/ { $a = 'digits'; } case /^w+$/ { $a = 'letters';} case /^[a-fd]+$/ { next; } case /^[A-Fd]+$/ { $a='hexa';} case ('1') { $a = 'one' } else { $a = ref $b; } }
  • 12. Is that all ? Oh, no, we didn't even scratch the surface of Ruby.
  • 13. Questions