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

I'm working on a project with a few other classmates where we're taking user input to form an xml, then turning it into a list using html. I'm fairly new to the class and having a bit of trouble. Here's what I have so far:
#!/usr/bin/perl use warnings; use strict; use lib '****'; use wishlist::globals; use wishlist::functions; # prompt for input information; print "Give the item a pretty name: "; chomp (my $name = <>); print "Now describe it and what about it makes you smile: "; chomp (my $desc = <>); print "How much does it cost? Not in rupees or credits,in U\$D!"; chomp (my $price = <>); print "Give me a link to click on later! Make sure it works! "; chomp (my $link = <>); print "You want this exact thingiemabobber? (TF)"; chomp (my $spec = <>); if ($spec eq "T" or $spec eq "t"){ $spec = 1; } elsif ($spec eq "F" or $spec eq "f"){ $spec = 0; } else { print "Invalid entry. You are being blonde! Go back to start!\n"; exit; } use XML::Simple qw (:strict); use Data::Dumper; my $filename = 'wishlist.xml'; my $xml = new XML::Simple; my $data = $xml->XMLin($filename, ForceArray => 1, KeyAttr => {'item'}, KeepRoot => 1, ); $data = $xml->XMLout; # output data updateXML ($name, $desc, $price, $link, $spec, $XMLFILE); # exit program exit;
Any help would be greatly appreciated!

Replies are listed 'Best First'.
Re: Help using XML Simple
by NetWallah (Canon) on Dec 07, 2014 at 01:48 UTC
    There is no meaningful data relationship between different parts of your code, so I'll direct you towards first creating a data structure.

    Read perldata to understand perl hashes.

    Get input from your users, and store the information in key-value pairs in your hash structure.

    After the hash structure is populated, usex XMLout to store the information in an XML file.

            "You're only given one little spark of madness. You mustn't lose it."         - Robin Williams

Re: Help using XML Simple
by ww (Archbishop) on Dec 06, 2014 at 19:19 UTC

    Now, you need to edit your post to tell us exactly HOW you're "having a bit of trouble" or, perhaps more precisely, WHAT the "trouble" is and what you've done or read to try to solve it.