|
||||||
| Perl Discussion for the PERL language - Practical Extraction and Reporting Language, is a programming language often used for creating CGI programs. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
I got a test next week in perl
If someone could help me with a few things later on id appreciate it..my msn is : pvpchina@hotmail.com - maybe I can pay you something wont take more than 1 hour i promise! just need sum questions answered |
| Sponsored Links |
|
|
|
|||
|
If you have questions you should just post them. If you are, on the other hand, trying to cheat on a test, forget it. As far as contacting you by email and providing personal service, I'll pass.
|
|
|||||
|
I agree with KevinADC. We do not cheat for you at school. If you are required to learn Perl in school then you should actually learn it, it may help you in the future.
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages! |
|
|||||
|
The chop() function removes the last character of any string, regardless of what that character actually is. chop("jordan") would return cause the string to become "jorda" with a return value of "n".
Using the Perl chop() function
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages! |
| Sponsored Links |
|
|
|
|||
|
look up perls builtin functions on the perldoc website, Perl version 5.10.0 documentation - perldoc.perl.org but as a personal observation, if you need assistance with chop() you're in for a long and hard journey in learning perl. Hopefully you were just joking.
|
|
|||
|
cool thanks, got it. so chop is used to remove the last character, and if i have
a new line, it will remove the new line when i press enter. now i need to know difference between $a = <STDIN>; my $a = <STDIN>; =)) which one to use? |
|
|||
|
#!/usr/bin/perl -w
use strict; sub funky(); funky(); print(funky()."\n"); my $random = <STDIN>; print(funky().$random); sub funky(){ my $var1 = $_[0] * 30; return $var1; } also need help with this one.. duno why it doesnt work =( |
|
|||
|
Stop doing this:
sub funky(){ do not put parenthesis after subroutine names, write it like this: sub funky { when you put parenthesis you are creating a prototype, there is no reason to do that and it will just complicate matters if you continue to do it. Here it is rewritten simpler and passing $random into the function properly: Code:
#!/usr/bin/perl
use warnings;
use strict;
my $random = 5;
print funky($random);
sub funky{
my $var1 = $_[0] * 30;
return $var1;
}
Last edited by KevinADC; 03-13-2008 at 04:22 AM. |
|
|||
|
thanks, im totally pro at functions now! =) gimi a task involving sub routines and functions.. wanna see if im pro ^^
Code:
#!/usr/bin/perl -w
use warnings;
use strict;
sub one;
sub two;
print ("\nPlease Choose a converter \n \n celcius to farenheit (press 1) \n Farenheit to celcius (press 2) \n");
my $a = <STDIN>;
if ($a == 1) {
print ("You chose option 1. Enter your value below \n\n");
my $b = <STDIN>;
print one($b,32,1.8);
}
sub one {
my $var1 = ($_[0] * $_[2]) +$_[1];
return $var1;
}
if ($a == 2) {
print ("You chose option 2. Enter your value below\n\n");
my $c = <STDIN>;
print two($c,32,(5/9));
}
sub two {
my $var2 = ($_[0] - $_[1]) * $_[2];
return $var2;
}
maybe someone see any improvements here? =)))) Last edited by pvpchina; 03-13-2008 at 01:19 PM. |
| Sponsored Links |
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| can someone tell me how to study c# better? | yulin11 | C# Programming | 6 | 02-25-2008 12:53 AM |
| Perl text parse help (noob) | dfp | Perl | 4 | 11-23-2007 02:57 PM |
| Looking for expert perl freelancer | hhheng | Request Services (Paid) | 1 | 11-12-2007 05:53 PM |
| Perl is Dead. Long live Perl. | Kernel | Programming News | 3 | 08-10-2007 11:49 AM |
| Perl Tutorial Course for Windows | priorityone | Perl | 22 | 02-11-2007 01:57 AM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |
Goal: 100,000 Posts
Complete: 98%