Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2014-08-20 19:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (122 votes), past polls