in reply to Grabbing tokens
You could try (untested):
my $output; chomp($output = `net use J: \\\\$hostname\\c\$`); if ($output =~ /successfully/) { print "You're in luck!\n"; }
If you're really partial to the third token idea, then split is your friend...
--
|
|---|