![]() |
small error..
hi, just learning perl can someone tell me whats wrong with this:
:
print "The months of the year are: \n";i get this error: :
teishu@debian:~/prl$ perl months.plthanks |
No error that trashes your program is a small error. The forum gets lebenty-jillion posts that claim failures are a bug. Bugs are relatively common, but they don't hold a candle, percentage-wise, to the mistakes that are programmer generated. Instead of asking "What's wrong with this", would you care to explain the difference between what you expect and what you get?
If not, we'll have to presume what you want versus what you get. At zero dollars per hour, that's not very profitable. Regardless of our altruistic propensities, that's not very satisfying. Your move. |
You are missing a ; after your array list. It should run then, but you probably won't get what you expect.
|
Exactly what do you want the program to do?
|
Every language and every application has fuck-ups. Ninety-nine percent of them are upstream, between the user's fingertips and the user's purported brain. Would you care to expand upon your problem, in some sort of meaningful detail?
|
Lets take a random stab in the dark and assume he wants to print out the contents of the month array accessing one element at a time. :| If this is not what you want, elaborate.
:
#!/usr/bin/perlOn a side note, why even include a newline in the values of the array? This is more of a formatting option than it is part of the data... so imho, its best left for the print statement to handle. On another side note, why even care how many elements the array has when printing it, if you are going to print them all anyway... do this: :
#!/usr/bin/perl |
Quote:
|
Perl is a good language... it gets more cryptic as you go. :) Glad it worked out for ya.
|
Yeah, good luck with Perl - it's actually quite a gentle learning curve and very rewarding, but there's an enormous amount of it to learn. I've been programming in Perl for years now and still feel like I've just scratched the surface - but that's not to say it hasn't already been incredibly useful to me. Nice choice. When you meet regular expressions, don't run for the hills: read slowly, understand them a bit at a time and they're amazing.
|
| All times are GMT -5. The time now is 4:50 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC