Draggy has asked for the wisdom of the Perl Monks concerning the following question:

Some help here would be awsome

I have to do this project for my linux class and i'm completly stuck may someone with some expert eyes can take a look at it for me?

use strict; use warnings; use diagnostics; use feature "say"; use feature "switch" use v5.22.1 say "What is your name?"; $channel1 <STDIN>; say "How many hours did you work?"; $channel2 <STDIN>; say "What is your pay?"; $channel3 <STDIN>; say $channel1; say Check Amount = $[(40*$channel3)+(($channel2-40)*$channel3*2)]

2018-07-08 Athanasius added code and paragraph tags

Replies are listed 'Best First'.
Re: Help with Perl Project please
by NetWallah (Canon) on Jul 06, 2018 at 05:23 UTC
    Welcome to the Monastery !

    Please read Markup in the Monastery and use <code> tags when you post code - otherwise, your post becomes mangled by html interpretation.

    Also, read How do I post a question effectively?. You did not indicate what problem you were having, or what result you were expecting.

    Use better variable names, like $name, $pay, $hours instead of $channeln.

    Do not use the obsolete "switch" module.

    Here is what I can make of your code - not sure what calculation you were trying:

    use strict; use warnings; use diagnostics; use feature "say"; use feature "switch"; use v5.22.1; say "What is your name?"; my $channel1 =<STDIN>; say "How many hours did you work?"; my $channel2 =<STDIN>; say "What is your pay?"; my $channel3 = <STDIN>; chomp for ($channel1,$channel2,$channel3); say $channel1; say "Check Amount = ", (40*$channel3)+(($channel2-40)*$channel3*2);
    Output:
    e$ perl test-channel.pl What is your name? rrr How many hours did you work? 44 What is your pay? 10 rrr Check Amount = 480

                    Memory fault   --   brain fried

      Thank You very much and I will check out those articles
        Hi Draggy,

        you've been kindly requested to use <code> and </code> tags for your code, and you obviously saw that request since you answered that post. Please amend your post accordingly. This will give all of us a better chance to help you.

Re: Help with Perl Project please
by kcott (Archbishop) on Jul 06, 2018 at 08:04 UTC

    G'day Draggy,

    Welcome to the Monastery.

    As already pointed out by ++NetWallah, there are issues with your post which make it difficult to read and leave us guessing what your actual problem is.

    Here's some problems I can see:

    • A number of your statements are not properly terminated. You'll need to add semi-colons in various places.
    • For "use v5.22.1", write "use 5.022_001" instead. See use for an explanation of why you should do this. Put it as your first statement (and add a semi-colon). This will automatically do "use strict;" and "use feature "say";" for you: you can remove those two statements from your code.
    • The switch feature is experimental. See "perlsyn: Switch Statements" and the recent discussion here: "Will 'when()' be removed or deprecated in upcoming version of Perl?". As per the previous point, "use 5.022_001;" will enable that feature anyway so you don't need that code. You don't appear to be using that feature in your posted code; continue to not use it.
    • With Q&A code, you're generally better off using "print 'Prompt: '; than "say 'Prompt: ';. The user gets to type the response immediately after the prompt, not below it.
    • And the last bit you posted: "say Check Amount = $[(40*$channel3)+(($channel2-40)*$channel3*2)]"! Missing quotes; missing terminator; $[ is already a special variable that is part of the core language but I get the impression you're trying to use a construct like "$[...]". This part needs a lot of work!

    Just in closing, I might add that, when posting here, typing your code by hand is not a good idea. I don't know if you are. If you copy and paste the actual code you're trying to run, we can see a verbatim copy and help you better. And, of course, post any code, data, and similar text between <code>...</code> tags.

    — Ken

A reply falls below the community's threshold of quality. You may see it by logging in.