A call to PERL wizards 
Author Message
 A call to PERL wizards

Hi--

I'm trying to do something very basic with PERL ("newbie!", you say?--yes,
unfortunately...) and just can't seem to get it to work... Grrr....(and I
_am_ RTFM, ;)

Here are the steps that I need to perform:

1. Call a UNIX command (output is a single string containing a variable
number of formatted fields), and store the output in a variable.

$var = `Command`;

Caveat: 'Command' outputs info to two different stream, STDERR and STDOUT
(_why_, I don't know...).

The fields are: <PID#><1 or more character-codes>(<USERname>)

2. Break the white-space delimited fields and store in an array of
formatted fields.

3. Pull apart each field and interpret the character-codes. ('split' may
be correct here).

I appreciate any help you could send my way (direct to me, where
appropriate); it is mainly the first two steps that I can't seem to get
working correctly.

Thanks!

/////////////////////////////////
Script concocted/tested thus far:

#!/usr/bin/perl
$prog = `/sbin/basename $0`;
chop $prog;


if($count != 1) {
    print "usage: $prog <SystemDevice>\n";
    exit;
    }

print "Analyzing activity on device ", $ARGV[$#ARGV], "...\n";

open(STDOUT, ">>$$tmp") || die "Can't redirect STDOUT!";
open(STDERR, ">>$$tmp") || die "Can't redirect STDERR!";

system("fuser -cu $ARGV[$#ARGV]");

close(STDOUT);
close(STDERR);

The file creation seems to work, but all attempts to read the contents of
a this file, break it and parse it have failed.

';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.
; Jay Brian Kummer                 I think all right-thinking people in this  ;
; Software Guy/Zappa Fan           country are sick and tired of being told   ;
; Department of Cellular Biology   that ordinary, decent people are fed up    ;
; Medical College of Wisconsin     in this country with being sick and tired. ;

; Searching for slack...           tired of being told that I am. (Python)    ;
';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.,';.



Sat, 06 Dec 1997 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. RFQ: Tk::Wizard - a wizard style widget for Perl/Tk

2. RFQ: Tk::Wizard - a wizard style widget for Perl/Tk

3. A question to Perl wizards

4. One for the Perl Wizards...

5. Perl Wizard Quiz

6. Perl for Netware wizards out there?

7. Any CGI/Perl Wizards in Utah?

8. Perl Wizards

9. HELP: (please help, wizards) Memory problems

10. Defining a wizard (was: Okay...)

11. easy XS question for a wizard from a newbie

 

 
Powered by phpBB® Forum Software