Here's the full code so you can get a better idea about where everything falls (note: not everything is fully implimented)
#/usr/bin/perl use Config::Simple; use Switch; tie %DVD, "Config::Simple", '/home/mike/MyVideos/titles'; tie %Config, "Config::Simple", '/home/mike/MyVideos/config'; tied(%Config)->autosave(1); while () { system "clear"; print "---------OPTIONS-----------\n"; print "\'add\' to enter new title:\n"; print "\'delete\' to remove a title:\n"; print "\'import\' to rip a new DVD:\n"; print "\'quit\' to exit:\n"; print "---------------------------\n"; print "DVD Titles\n\n"; foreach (sort keys %DVD) { print "$_: \n"; } print "\nEnter the name of the movie you want to see:"; chomp($title = <STDIN>); switch ($title) { case ('add') { &add_title(); } case ('delete') { &remove_title(); } case ('import') { open(LSDVD, "lsdvd -p /dev/hdc|"); @lsdvd = <LSDVD>; shift(@lsdvd); print "$lsdvd[1]"; sleep(1); $lsdvd = $lsdvd[1]; @lsdvd = split(/ /, $lsdvd); $lsdvd = pop @lsdvd; print $lsdvd; $_ = $lsdvd; if (/(\w+)/) { print $!; } close(LSDVD); sleep(5); #&import_dvd(); } case ('quit') { &quit(); } else { $title = "default." . "$title"; $i =0; foreach (keys %DVD) { if ($title eq $_) { $i = 1; &play_movie(); } } if ($i eq 0) { system "clear"; print "Please enter a valid title!\n"; sleep(1); } } } } sub play_movie { print "Loading Movie...\n"; @mount = ("sudo mount" , "-o loop", "-t auto " , "\"$DVD{$title}\" +" , " /media/dvdbackup"); print @mount; system "@mount"; print "\nEnjoy!\n"; system("xine -I -A esd -B -D -f --no-splash --verbose=0 dvd:/media +/dvdbackup/1"); system("sudo umount /media/dvdbackup"); print "Thank you for watching.\n"; } sub add_title { system "clear"; print "Enter the name of the movie: "; chomp($name = <STDIN>); $name = "default." . "$name"; print "Enter the file location: "; chomp($loc = <STDIN>); print $name . $loc; tied(%DVD)->param( "$name" , "$loc" ); tied(%DVD)->write(); print "%DVD"; sleep(5) } sub import_dvd { } sub remove_title { system "clear"; print "Enter Title you wish to remove (this will delete the .iso): +"; chomp($title = "default." . <STDIN>); print $DVD{$title} . "\n"; print $title . "\n"; tied(%DVD)->delete("$title"); tied(%DVD)->write(); sleep(2); } sub quit { tied(%DVD)->write(); exit; }


I realize the code is undoubtedly ugly, this is my first #real# program so be gentle. The sticky part now is in the import section. You guys are a life saver.
By the way I didn't want to impliment unlink until I had the import code done (just incase).

In reply to Re: Strange Behavior by PsyberOne
in thread Strange Behavior by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.