Search Results

Search found 3 results on 1 pages for 'foxhop'.

Page 1/1 | 1 

  • Why doesn't my Perl code work when I put it in a foreach loop?

    - by foxhop
    This code outputs the scalars in the row array properly: $line = "This is my favorite test"; @row = split(/ /, $line); print $row[0]; print $row[1]; The same code inside a foreach loop doesn't print any scalar values: foreach $line (@lines){ @row = split(/ /, $line); print $row[0]; print $row[1]; } What could cause this to happen? I am new to Perl coming from python. I need to learn Perl for my new position.

    Read the article

  • Perl, Array called by scalar doesn't work in foreach loop.

    - by foxhop
    This code outputs the scalars in the row array properly: $line = "This is my favorite test"; @row = split(/ /, $line); print $row[0]; print $row[1]; The same code inside a foreach loop doesn't print any scalar values: foreach $line (@lines){ @row = split(/ /, $line); print $row[0]; print $row[1]; } What could cause this to happen? I am new to perl coming from python. I need to learn perl for my new position.

    Read the article

1