Here's what I did. First, I fixed the value of $/, so the while() loop will work. He also had a print "\n\r" which I changed to a plain "\012". Anyway, you don't need to push @ARGV; you can just replace @ARGV with whatever values you want. In this case I did: @ARGV = split m/\s+/, join " ", $mac_answer, <>; That joins your "-h", "whois.geektools.com", and the contents from the file into one string, and then splits them on whitespace. I'd personally get the MacPerl::Ask out of there; I don't want MacPerl to come to the front, and I can just put default host as "whois.geektools.com" instead of "whois.internic.net". #!/usr/bin/perl # Sample whois(1) client for PPT. # # Yiorgos Adamopoulos, adamo@ieee.org, Mon Mar 22 15:28:05 EET 1999 # Mon Mar 22 16:24:23 EET 1999 # # The command line switches are taken from the FreeBSD whois(1) page # Added a -6 switch for 6BONE (whois.6bone.net) # Added a -g switch for .gov (whois.nic.gov) use IO::Socket; $host = "whois.internic.net"; if ($^O eq 'MacOS') { my $mac_answer = MacPerl::Ask( 'Enter Command-Line Options', '-h whois.geektools.com' ); @ARGV = split m/\s+/, join " ", $mac_answer, <>; } while ($i = shift) { if ($i eq "-a") { $host = "whois.arin.net"; last; } elsif ($i eq "-d") { $host = "whois.nic.mil"; last; } elsif ($i eq "-p") { $host = "whois.apnic.net"; last; } elsif ($i eq "-r") { $host = "whois.ripe.net"; last; } elsif ($i eq "-g") { $host = "whois.nic.gov"; last; } elsif ($i eq "-6") { $host = "whois.6bone.net"; last; } elsif ($i eq "-h") { $host = shift; last; } else { unshift(@ARGV, $i); last; } } $| = 1; $sock = new IO::Socket::INET(PeerAddr => $host, PeerPort => 43, Proto => 'tcp'); die "IO::Socket::INET $!" unless $sock; foreach $i (@ARGV) { print $sock "$i "; } local $/ = "\012"; print $sock $/; while (<$sock>) { chomp; print "$_\n"; } close $sock; __END__ -- Chris Nandor | pudge@pobox.com | http://pudge.net/ Andover.Net | chris.nandor@andover.net | http://slashcode.com/ # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org