Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: How can I store a scalar variable, coming out of a do-until loop, as an element in an array for further operations?

by aitap (Deacon)
on Aug 31, 2012 at 08:10 UTC ( #990938=note: print w/replies, xml ) Need Help??


in reply to How can I store a scalar variable, coming out of a do-until loop, as an element in an array for further operations?

print "Cannot open file \"$filename\"\n\n"; # Line 16 exit;
You can use die instead of print and exit. Also, die throws exceptions, so they can be catched and handled outside the running code. This can be useful for generating backtraces and other debugging things.

 @all_sentences=(my $sentence);                 # Line 34
Did you mean push? push @all_sentences,$sentence;

 my $diff_letters="code?????";             # Line 38  
You can use ... when you don't know what to write, Perl will automatically throw "Unimplemented" exception at this point. Anyway, did you mean for (1..$#all_sentences) {print abs(length $all_sentences[$_-1] - length $all_sentences[$_]), "\n";}? See abs, length, perlsyn for more information.

Sorry if my advice was wrong.
  • Comment on Re: How can I store a scalar variable, coming out of a do-until loop, as an element in an array for further operations?
  • Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://990938]
help
Chatterbox?
and monks are getting baked in the sun...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2016-12-07 12:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (125 votes). Check out past polls.