Post Reply 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TVNorge og FEM
30-11-2009, 00:35
Post: #11
TVNorge og FEM
Quote:Well... We could ofcourse stay with perl, but then I need to brush up more on my perl-skills...My main problem is that I can't for the love of god figure out perls array/hash/hasharray/thingamajig stuff. When do i use @variable, $variable $@variable etc...
I've not written more than a couple of smallish ImageJ scripts with Ruby, but there seems to be a lot to like...For isn't as bad as you think (probably), although I've probably made at least one howler:$ prefix -> a single value@ prefix -> a list of values% prefix -> a list of pairs (hash)So, if @array = ("a","b","c")then$array, %array are something else completely$array[1] is the single value "b"@array[1] is an array slice with the single value ("b")@array[0,2] is a more useful array slice ("a","c")And, if %hash = ("One" => 1, "Two" => 2, "Three" => 3)then$hash and @hash are completely different variable.$hash{"One"} is the single value "1"@hash{"One","Three"} is the slice of hash values (1,3).Pairs of symbols are used for dereferencingAngry$arrayref = the array referenced by $arrayref%$hashref = the hash referenced by $hashref$$ref = the simple value referenced by $refbut usually it is clearer to use the arrow format:$arrayref->[1]$hashref->{key}$reftoarrayofhashes->[1]->{"key"}Made less progress on improving the TVNorge/FEM module than I planned this weekend but maybe in the next couple of days....David
Find all posts by this user
Quote this message in a reply
Post Reply 

Forum Jump:

User(s) browsing this thread: 1 Guest(s)