>nothing HAS to be global. you can pass it to a sub, you can store the >options in a hash (my way and easy with getopt::long), etc. some globals >may be useful but always using them or not know other ways is bad.
Ok, fair enough. >no. it is a single string with 4 lines in it. why would you think >foreach would loop over its lines vs its single string? arrays can >contain strings without lines and a scalar could contain a single string >with lines. so foreach is neutral and just loops over what you pass it >in terms of perl elements. if you want lines, split them yourself or get >them some other way. e.g. backticks in a list context will split its >output into lines for you. i dunno how you are doing this telnet thing >(as i said SHOW MORE/ALL CODE :). Well the rest of the code _only_ does the telnet part and has too much hardcoded stuff atm. It works perfectly as per cpan docs. I'm just stuck on formatting the sub to match a string, just don't know enough about Perl:) I think I have it: sub parse_output { my ( $string, $match ) = @_; die "Error in parse_output sub\n" unless ((defined $string) || (defined $match)); if ( $string =~ /$match/ ) { return "OK"; } else { return "CRITICAL"; } } $status = parse_output($output, $expect); print "Status: $status\n"; >From what I can see, this follows all the suggestions you have provided? Thanks for all your help! jlc -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/