Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Scripting Help

by RichardK (Parson)
on Dec 14, 2015 at 19:19 UTC ( #1150267=note: print w/replies, xml ) Need Help??


in reply to Scripting Help

In what way doesn't it work? do flames shoot out of the back of your computer or something else?

Try the basic debugging checklist for some general help on how to fix anything.

Also you could try checking the return values from the system calls.

or step through it one line at a time in the debugger.

Replies are listed 'Best First'.
Re^2: Scripting Help
by Anonymous Monk on Dec 14, 2015 at 19:48 UTC
    Sorry I have been so frustrated with it after working on it for 6 hours lol. The issue I get for adding a group is: Can't use string ("Test2") as a HASH ref while "strict refs" in use at ./example3 line 35, <> line 2. The error I get for deleting a group that I made previously in an earlier class, I get: Can't use string ("Test") as a HASH ref while "strict refs" in use at ./example3 line 44, <> line 2.

      In two places you repeat the code:

      my $group_name = get_input("Enter Group Name: "); if ( exists $group_name->{$group_name} ) {

      The sub get_input() returns a string which, as the error messages are telling you, you are trying to use as hash reference with exists. On the left side of the -> arrow $group_name is a hash reference and on the right side of the arrow it is a string and key to the hash. It looks like in read_doc you need to create a hash of groups and return a reference to it.

      Ron
      For the code you posted I get
      Global symbol "$group_id" requires explicit package name .. Global symbol "$choice" requires explicit package name ..
      poj
        explicit package name as in /etc/group? The choice is made prior to that, it only throws up after I add my groups name.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1150267]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2018-07-22 14:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (454 votes). Check out past polls.

    Notices?