ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
but for some reason when i compile this i get..
systax error at test1.pl line 5, near "$browswer("
execution of test1.pl aborted due to comilation erros.
ok, it's spelt "browser" first off, but change the variable name, you can't have the same name for two variables. you don't actually *need* a variable in the foreach:
another questions.. if u dont use a name for the foreach loop.. will u still be able to create more than one foreach loop with out creating other complications?
Up to your first example - you're simply missing an ; at the end of the assignment. ; may only be left off at the end of a block, but it's a good idea to put them there too, in case you add some commands. So the correct code reads (spellchecked ):
To answer your other questions:
1) You can nest loops without naming then - you just can't refer to them should you want to end the loop or progress to the next item.
2) Perl is a scripting language nad is interpreted - not compiled.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.