The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Why is my stupid perl not working? by i_am_pi 2002-07-22 16:16:08
sub t2h()
{
print "Type something to convert from ascii to Hex.";
print " Cuts off after one line.\n";
print unpack("h*", <>),"\n";
}
sub h2t()
{
print "Type something to convert from Hex to ascii.";
print " Cuts off after EOF (Control-D).\n";
print pack("h*",<>),"\n";
}
while (1)
{
print <<EOF;
Welcome to the stupid-perl-crap.
What do you want to do?
1. Convert from Ascii Hex to Text
2. Convert from Text to Ascii Hex
3. Quit
EOF

$_ = <STDIN>;

exit if /3/;
t2h() if /2/;
h2t() if /1/;

}

It goes to these functions, but only one of them works, and that's t2h. It prints out some hex (including newline, not what I want). That same hex doesn't work through the inverse function.

Pi
[ Reply ]
  suggestion by nimdokk2002-07-22 17:11:29
  What he said by mikosullivan2002-07-22 18:19:00
    yeah by nimdokk2002-07-22 18:30:12
      No problem, TMTOWTDI after all... (n/t) by Schol-R-LEA;22002-07-22 22:40:14

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)