in reply to <> diamond Operator
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Solution for your prof
by kocaweb (Initiate) on Apr 07, 2005 at 19:41 UTC | |
Thanks a lot guys, and you were right I should start learning some perl, I didn't realize How far behind I was. I did start some reading I did lot of research on google read lot of scripts, and I started to like perl. Maybe I am at the wrong forum( if I am could point me to the right direction)., cuz I am just a beginner. And I think perlmonks is for more advanced help. You may laugh at my problems, but everybody is at different stage of knowledge. any ways. I did start lab09 on my own today. Could you please tell me guys what do you think and if there is any errors, here is lab 9 and I am really sorry if I am waisting your time. this would be my last thing asking.
here is the script
| [reply] |
by dragonchild (Archbishop) on Apr 07, 2005 at 19:55 UTC | |
You're actually getting the totals for all the files. Try the following:
The major change is the my $sum = 0; line. It scopes $sum to be within the foreach-loop. This means that it gets reset every time. You'll notice I added strict to my version. This provides some typo-checking, and also requires that you declare your variables (preferably with my) beforehand. This node was much better than your previous nodes. You posted what you tried and why it didn't work. This means we'll help you out, explaining why what you did didn't work and how to improve it. We'll edit, not create. | [reply] [d/l] [select] |
by kocaweb (Initiate) on Apr 07, 2005 at 21:55 UTC | |
wow guys, I really feel good know, actually I am learning lot of stuff, I've been awake from 7 am. and learning pearl all day long. Here is the script tha I modified. The script should do the following: copy all the files that were entered in command line to a folder lab06d which is already created. and add a "b" at the end of the file to tell that is a backup. also it should print the total value added from all the files. but I don't thing is adding the value from all the files together.
here is the script again:
| [reply] |
by dragonchild (Archbishop) on Apr 08, 2005 at 01:06 UTC | |
by starbolin (Hermit) on Apr 08, 2005 at 03:31 UTC | |
by starbolin (Hermit) on Apr 07, 2005 at 20:53 UTC | |
I gave you a plus vote for taking your medicine and coming back again. I'd give you another plus for a well written second question if I could. I noticed someone still downvoted you on your second question showing perhaps still some bias towards homework questions. Or it could because of the reference to Perl Monks being too advanced. There are all levels of programmers here at the Monastery and many basic questions asked and many basic questions answered. We all think this is the best forum for Perl you'll find and would encourage you to keep returning. There also is also a lot of good basic material available here, some of it was already pointed out to you and you have the book. We'll expect you to do your research before posting as you've already seen. Please feel free to come here for help and bring a thick skin. P.S. You'll get a wider readership on new questions if you start a new node rather than posting as a response to an existing node. s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo} | [reply] |
|
Re^2: Solution for your prof
by nikos (Scribe) on Apr 07, 2005 at 20:23 UTC | |
| [reply] |
by 5mi11er (Deacon) on Apr 07, 2005 at 22:03 UTC | |
Doing someone else's homework, in it's entirety, is bad in many ways: | [reply] |
by nikos (Scribe) on Apr 07, 2005 at 23:48 UTC | |
| [reply] |
by starbolin (Hermit) on Apr 08, 2005 at 04:18 UTC | |
He's falling under the spell of Perl Monks already. I wrote some stuff I was going to post here but this node already covers it Why do I get such negative votes?. In addition; Complaining about down votes is the fastest way to get down votes. I didn't down vote this because you were asking a question but you may want to avoid this area in the future. You are doing very well, keep at it, keep learning, we'll be here. You could always try a compliment on my clever signature;-) s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo} | [reply] |
|
Re^2: Solution for your prof
by inman (Curate) on Apr 08, 2005 at 07:59 UTC | |
I take your point about making his professor believe it was him. Even this code is too well written for a newbie. Try the following newbie style tips...
| [reply] [d/l] |