[13710] in Perl-Users-Digest
Perl-Users Digest, Issue: 1120 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 19 17:05:57 1999
Date: Tue, 19 Oct 1999 14:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940367113-v9-i1120@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 19 Oct 1999 Volume: 9 Number: 1120
Today's topics:
Re: $ is sneaky, point me to a faq or help please (Tad McClellan)
Re: A question on Perl/Tk <aqumsieh@matrox.com>
Re: array <kpmonroe@unity.ncsu.edu>
Re: array <msalter@bestweb.net>
Re: array <marcel.grunauer@lovely.net>
Re: array <nguyend7@msu.edu>
Re: array <marcel.grunauer@lovely.net>
Re: array <dave@dave.org.uk>
Re: creating a list of unique records (Craig Berry)
Re: creating a list of unique records (Michael Budash)
creating variable question? beta1_version@yahoo.com
creating variable question? beta1_version@yahoo.com
Re: creating variable question? (Craig Berry)
dec to bin conversion and vice versa (Thuan Pham)
Re: erorr output to browser? <flavell@mail.cern.ch>
Re: erorr output to browser? <jtolley@bellatlantic.net>
Ever thought about keeping a Development Diary? <matthew@neutronic.co.uk>
Re: formatting text with filling '.'s (Tad McClellan)
Re: formatting text with filling '.'s <jeffp@crusoe.net>
Re: Fuser Unix Command in Perl <gellyfish@gellyfish.com>
Re: help for functioin fork under win98 <dan@tuatha.sidhe.org>
HELP!! Pattern match stops before end of input <dean_j_pompilio@yahoo.com>
I pass by reference, but my array is unchanged. <agon@unm.edu>
Re: I pass by reference, but my array is unchanged. <makkulka@cisco.com>
Re: linux perl editor? <gellyfish@gellyfish.com>
Re: Manipulating variables (Tad McClellan)
Re: Monitoring the clicks of a banner <keefner@kinetic.com>
Re: need cgi script (David H. Adler)
Re: Newbie regex question on quoting jspangen@my-deja.com
Re: Newbie regex question on quoting (Tad McClellan)
Re: Newbie regex question on quoting (Gordon)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 19 Oct 1999 11:36:50 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: $ is sneaky, point me to a faq or help please
Message-Id: <i63iu7.4sc.ln@magna.metronet.com>
Thomas B. Holdren (bholdren@NOSPAMMY.linkohio.com) wrote:
: ($mess, @attach) = split (/\-\-$boundary/, $message);
^ ^
^ ^ unnecessary and misleading
: But MS puts a '$' in the boundary, and I can't match the boundaries on
: messages with $ in the boundary. If I s/\$//g; the whole message it then
: works, but I can't go removing $'s from e-mails just because. So what am I
: missing?
($mess, @attach) = split (/--\Q$boundary/, $message);
or, before you get to _your_ statment above:
$boundary = quotemeta $boundary;
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 19 Oct 1999 13:21:15 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: A question on Perl/Tk
Message-Id: <x3yiu43b71x.fsf@tigre.matrox.com>
Lishan Song <lishans@evitech.fi> writes:
> Could anyone help me out of the problem?
Perhaps you should post to comp.lang.perl.tk which discusses
Perl/Tk.
> In my Perl/Tk script, I want to do something periodically (let's
> say every 1 minute). But the MainLoop call will just sit in its
> internal loop. I know this MainLoop waits for events, eg, button.
> But is there a method for this call to work with sleep() so that
> after sleep, I can do something?
Yes. Use the repeat() or after() methods.
HTH,
--Ala
------------------------------
Date: Tue, 19 Oct 1999 15:13:09 -0400
From: Kevin Monroe <kpmonroe@unity.ncsu.edu>
Subject: Re: array
Message-Id: <380CC2C5.786AD8EB@unity.ncsu.edu>
GiN wrote:
> I have an array: @arr = ("weeh", "waah", "wuuh", "wiih", "wooh");
>
ok.
>
> what is the simpliest way to remove "wuuh" from @arr?
>
the first thing that comes to mind is splice. Read up on the
documentation and the faq. but here is a little help in advance
#!/usr/local/bin/perl -w
#use strict;
@arr = ("weeh", "waah", "wuuh", "wuuh", "wooh");
splice (@arr,2,1);
print @arr;
kevin
------------------------------
Date: Tue, 19 Oct 1999 20:04:11 GMT
From: Mike Salter <msalter@bestweb.net>
Subject: Re: array
Message-Id: <Pine.BSF.4.05.9910191603360.29350-100000@monet.bestweb.net>
On 19 Oct 1999, GiN wrote:
G>I have an array: @arr = ("weeh", "waah", "wuuh", "wiih", "wooh");
G>
G>what is the simpliest way to remove "wuuh" from @arr?
G>
G>i am currently using foreach etc..
@ar = map {$_ if !/wuuh/} @ar;
Mike
------------------------------
Date: Tue, 19 Oct 1999 20:07:05 GMT
From: Marcel Grunauer <marcel.grunauer@lovely.net>
Subject: Re: array
Message-Id: <PN0MONUL5jrrg6O+L6G26MdYAF6D@4ax.com>
On Tue, 19 Oct 1999 20:04:32 +0100, Dave Cross <dave@dave.org.uk>
wrote:
> On 19 Oct 1999 18:28:06 GMT, GiN@hookers.org (GiN) wrote:
> >I have an array: @arr = ("weeh", "waah", "wuuh", "wiih", "wooh");
> >
> >what is the simpliest way to remove "wuuh" from @arr?
> >
> >i am currently using foreach etc..
>
> @arr = @arr[0, 1, 3, 4];
Tsk, tsk.
splice @arr,2,1;
--
Marcel, Perl Padawan
sub AUTOLOAD{$_=$AUTOLOAD;s;.*::;;;y;_; ;;print}&Just_Another_Perl_Hacker;
------------------------------
Date: 19 Oct 1999 20:10:33 GMT
From: Dan Nguyen <nguyend7@msu.edu>
Subject: Re: array
Message-Id: <7uij7p$m9e$2@msunews.cl.msu.edu>
Mike Salter <msalter@bestweb.net> wrote:
: On 19 Oct 1999, GiN wrote:
: G>I have an array: @arr = ("weeh", "waah", "wuuh", "wiih", "wooh");
: G>
: G>what is the simpliest way to remove "wuuh" from @arr?
: G>
: G>i am currently using foreach etc..
: @ar = map {$_ if !/wuuh/} @ar;
That would be correct if you wanted to replace wuuh with "";
So @arr[2] eq "" is true. If you wanted to completely remove the item
from the list, and not replace it with "" then you would probably want
to use grep.
--
Dan Nguyen | It is with true love as it is with ghosts;
nguyend7@msu.edu | everyone talks of it, but few have seen it.
dnn@debian.org | -Maxime De La Rochefoucauld
25 2F 99 19 6C C9 19 D6 1B 9F F1 E0 E9 10 4C 16
------------------------------
Date: Tue, 19 Oct 1999 20:13:09 GMT
From: Marcel Grunauer <marcel.grunauer@lovely.net>
Subject: Re: array
Message-Id: <jt4MOFPEAfATiGvbj2vgwvnLJcZB@4ax.com>
On Tue, 19 Oct 1999 20:04:32 +0100, Dave Cross <dave@dave.org.uk>
wrote:
> On 19 Oct 1999 18:28:06 GMT, GiN@hookers.org (GiN) wrote:
> >I have an array: @arr = ("weeh", "waah", "wuuh", "wiih", "wooh");
> >
> >what is the simpliest way to remove "wuuh" from @arr?
> >
> >i am currently using foreach etc..
>
> @arr = @arr[0, 1, 3, 4];
Tsk, tsk.
splice @arr,2,1;
--
Marcel, Perl Padawan
sub AUTOLOAD{$_=$AUTOLOAD;s;.*::;;;y;_; ;;print}&Just_Another_Perl_Hacker;
------------------------------
Date: Tue, 19 Oct 1999 21:24:37 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: array
Message-Id: <QNMMOEqN11IXCNNJfXqhPaKuglul@4ax.com>
On Tue, 19 Oct 1999 20:07:05 GMT, Marcel Grunauer
<marcel.grunauer@lovely.net> wrote:
>On Tue, 19 Oct 1999 20:04:32 +0100, Dave Cross <dave@dave.org.uk>
>wrote:
>
>> On 19 Oct 1999 18:28:06 GMT, GiN@hookers.org (GiN) wrote:
>> >I have an array: @arr = ("weeh", "waah", "wuuh", "wiih", "wooh");
>> >
>> >what is the simpliest way to remove "wuuh" from @arr?
>> >
>> >i am currently using foreach etc..
>>
>> @arr = @arr[0, 1, 3, 4];
>
>Tsk, tsk.
>
>splice @arr,2,1;
tmtowtdi :-)
--
Dave Cross <dave@dave.org.uk>
<http://www.dave.org.uk>
------------------------------
Date: Tue, 19 Oct 1999 20:17:59 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: creating a list of unique records
Message-Id: <s0pkfn3tr0159@corp.supernews.com>
Michael Budash (mbudash@sonic.net) wrote:
: In article <s0p8l0i7r0131@corp.supernews.com>, cberry@cinenet.net (Craig
: Berry) wrote:
: >: foreach (sort keys %hash) { print; }
: >
: >This will lose the input ordering unless you take some other step to
: >record it or recreate it. But it's certainly the case that you can
: >improve on reading the whole thing into memory.
:
: foreach (sort keys %hash) { print; }
: ??
This assumes the original array's sort was lexical, something never
specified by the poster.
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: Tue, 19 Oct 1999 13:46:31 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: creating a list of unique records
Message-Id: <mbudash-1910991346310001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>
In article <s0pkfn3tr0159@corp.supernews.com>, cberry@cinenet.net (Craig
Berry) wrote:
>Michael Budash (mbudash@sonic.net) wrote:
>: In article <s0p8l0i7r0131@corp.supernews.com>, cberry@cinenet.net (Craig
>: Berry) wrote:
>: >: foreach (sort keys %hash) { print; }
>: >
>: >This will lose the input ordering unless you take some other step to
>: >record it or recreate it. But it's certainly the case that you can
>: >improve on reading the whole thing into memory.
>:
>: foreach (sort keys %hash) { print; }
>: ??
>
>This assumes the original array's sort was lexical, something never
>specified by the poster.
>
correct. i was assumed by me. good call.
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Tue, 19 Oct 1999 19:57:56 GMT
From: beta1_version@yahoo.com
Subject: creating variable question?
Message-Id: <7uiift$qte$1@nnrp1.deja.com>
I am trying to create three variable, but
don't quite understand how to do it.
example
# > ping caltech.edu
caltech.edu is alive
I want $one=caltech.edu , $two=is, $three=alive
once I have those as variables,
I want to do a
system("cat $one $two $three);
but how???
thanks in advance.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 19 Oct 1999 19:57:22 GMT
From: beta1_version@yahoo.com
Subject: creating variable question?
Message-Id: <7uiies$qt8$1@nnrp1.deja.com>
I am trying to create three variable, but
don't quite understand how to do it.
example
# > ping caltech.edu
caltech.edu is alive
I want $one=caltech.edu , $two=is, $three=alive
once I have those as variables,
I want to do a
system("cat $one $two $three);
but how???
thanks in advance.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 19 Oct 1999 20:33:22 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: creating variable question?
Message-Id: <s0plci6r0115@corp.supernews.com>
beta1_version@yahoo.com wrote:
: I am trying to create three variable, but
: don't quite understand how to do it.
:
: example
: # > ping caltech.edu
: caltech.edu is alive
If you're talking about capturing the output from ping, look at the
backtick-quoting or qx() syntax in perlop. For your example,
$res = `ping caltech.edu`;
: I want $one=caltech.edu , $two=is, $three=alive
my ($one, $two, $three) = split ' ', $res;
(See: perldoc -f split)
: once I have those as variables,
: I want to do a
: system("cat $one $two $three);
:
: but how???
Well, by adding " before the closing paren, if you want it to compile. :)
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: Tue, 19 Oct 1999 20:15:57 GMT
From: phamt1@gusun.georgetown.edu (Thuan Pham)
Subject: dec to bin conversion and vice versa
Message-Id: <380cd1b4.0@bandit>
Hello all:
I would like to know if anyone out there has a Perl program/subroutine
that does the conversion from decimal to binary and vice versa that I can take
look at?
Any help would be greatly appreciated.
Thanks,
Thuan
------------------------------
Date: Tue, 19 Oct 1999 20:51:55 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: erorr output to browser?
Message-Id: <Pine.HPP.3.95a.991019204736.29775A-100000@hpplus01.cern.ch>
On 19 Oct 1999, Jeff Zucker wrote:
> amonotod wrote:
> >
> > In article <7ui1ps$e85$1@nnrp1.deja.com>,
> > newsmf@bigfoot.com wrote:
> > > Wheen debugging perl cgi-scripts, how can I get the error output to
> > > show up in the browser instead of just getting the generic "Internal
> > > Server Error" message?
> >
> > There really is no way to do what you ask
[because the Perl script failed to compile, or the server config was
such that it refused to even consider running it.]
> Bzzzt! Wrong answer. You could redefine your DIE, or more simply:
>
> use CGI::Carp qw(fatalsToBrowser);
And this works exactly how, when the program that contains it hasn't
even been compiled?
Might one suggest that the hon. Usenaut actually _read_ the statements
complained of, before jumping onto the buzzer?? There's enough noise
around here already.
------------------------------
Date: Tue, 19 Oct 1999 19:53:39 GMT
From: James Tolley <jtolley@bellatlantic.net>
Subject: Re: erorr output to browser?
Message-Id: <380CCBDB.D520832B@bellatlantic.net>
>
> > > > Wheen debugging perl cgi-scripts, how can I get the error output to
> > > > show up in the browser instead of just getting the generic "Internal
> > > > Server Error" message?
> > >
> > > There really is no way to do what you ask
>
> [because the Perl script failed to compile, or the server config was
> such that it refused to even consider running it.]
>
> > Bzzzt! Wrong answer. You could redefine your DIE, or more simply:
> >
> > use CGI::Carp qw(fatalsToBrowser);
>
> And this works exactly how, when the program that contains it hasn't
> even been compiled?
#!/usr/bin/perl
BEGIN {
print "Content-type: text/html\n\n";
use CGI::Carp qw(fatalsToBrowser);
}
I think this should work in almost all circumstances, since the BEGIN block
will be run before the rest of the script compiles (or fails to compile). If
this script fails entirely, try changing the path to perl.
Is there any error for which this won't give helpful feedback? Very few, at
any rate.
hth
James
------------------------------
Date: Tue, 19 Oct 1999 21:05:49 +0100
From: "Matthew Peddlesden" <matthew@neutronic.co.uk>
Subject: Ever thought about keeping a Development Diary?
Message-Id: <380cd365.0@london.netkonect.net>
Visit http://www.deardiary.net/ - here's why:
So, you're writing the latest top of the line software and you want to keep
in touch with your users, let them know what's going on. Use a Development
Diary, make notes of your progress and your problems - maybe someone out
there has seen the same problem and can help you fix it that bit quicker.
All the greats keep Development Diaries in the .plan - well, why not use our
brand new service 'Dear Diary' - it's not just about keeping a diary, we use
it ourselves to maintain our development diary of progress on the system as
we go.
The whole system is extremely easy for readers to navigate, you get your own
URL to go straight to your diary and what's more it is extremely
customisable. Once you've set it up how you want (or left it at the
default, entirely up to you) you can add new entries and update existing
ones to your hearts content, it's only a few short clicks for each entry and
you need do no organisation for it to all work - our system does it all for
you leaving YOU to concentrate on what counts - the software you're writing.
So, like I said at the top, visit http://www.deardiary.net - we are avid
developers and users of the system, currently around 7,000 lines of code
sitting behind it so it's not leaving the work up to you!
See you online!
Matthew Peddlesden (NeutronIC)
Senior Developer, the Dear Diary Project.
------------------------------
Date: Tue, 19 Oct 1999 11:13:46 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: formatting text with filling '.'s
Message-Id: <ar1iu7.loc.ln@magna.metronet.com>
Jared Evans (jared@frontiernet.net) wrote:
: Is there an easy way to produce this output:
: Eggs..............$2.00
: Bacon.............$3.00
: One gallon Milk...$4.00
Yes.
print 'Eggs..............$2.00
Bacon.............$3.00
One gallon Milk...$4.00
';
But somehow I don't think you asked the right question there.
: As you can see the prices are all lined up and the area between the
: item and prices are filled with '.' instead of spaces.
: I could do character counting and add the right number of dots to each line,
: but am wondering if there was a dirty n' easy trick to do with with something
: like Format?
You never say where the name and price are to come from,
nor how you get them "lined up".
So I get to choose wherever I want.
I'll take them from a hash.
sprintf() and tr/// can do it without explicitly counting characters:
------------------------
#!/usr/bin/perl -w
use strict;
my %h = qw( Eggs $2.00
Bacon $3.00
Milk $4.00 );
foreach my $key (sort keys %h) {
my $str = sprintf "%-8s %s\n", $key, $h{$key};
$str =~ tr/ /./;
print $str;
}
------------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 19 Oct 1999 16:57:48 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: formatting text with filling '.'s
Message-Id: <Pine.GSO.4.10.9910191637330.21020-100000@crusoe.crusoe.net>
[posted & mailed]
On Oct 19, Jared Evans blah blah blah:
> Is there an easy way to produce this output:
>
> Eggs..............$2.00
> Bacon.............$3.00
> One gallon Milk...$4.00
I'm going to show you a subroutine. Let's say I wanted the output to look
like:
Eggs..............$2.00
Bacon.............$3.00
One Gallon Milk...$4.00
Used Car......$6,000.00
@data = (
["Eggs", '$2.00'],
["Bacon", '$3.00'],
["One Gallon Milk", '$4.00'],
["Used Car", '$6,000.00'],
);
for (@data){
print pad($_->[0], ".", $_->[1], 24), "\n";
}
sub pad {
my ($ls,$mid,$rs,$len) = @_;
# first, make sure the line can fit
# if not, make the left hand side end in "-"
# and allow for two of the $mid character
substr($ls,$len-length($rs)-3) = "-" if length($ls.$rs) >= $len;
return $ls . ($mid x ($len - length($ls.$rs))) . $rs;
}
Rarely do I create an entire solution for someone like that. It was a
benefit to me, though, so I did it.
--
MIDN 4/C PINYAN, USNR, NROTCURPI
jeff pinyan japhy@pobox.com
perl stuff japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN
------------------------------
Date: 19 Oct 1999 19:56:46 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Fuser Unix Command in Perl
Message-Id: <7uiidu$8d1$1@gellyfish.btinternet.com>
On 19 Oct 1999 10:14:43 +0100 Jonathan Stowe wrote:
> Russ Allbery <rra@stanford.edu> wrote:
>> Felipe Guilherme Prata Brito <970680@dcc.unicamp.br> writes:
>>
>>> Does anyone have a source code of the Unix command "fuser" in Perl??
>>> Does anyone kwon where can I find it??
>>
>> I don't know of anyone who's done fuser in Perl even on Linux;
>>
>
> I did - on Linux and posted it here late last year or early this but buggered
> if I can find it on Deja now ... I'll dig it out when I get home.
>
Aha - I found : it a little fiddling to get it not break if fed a bad filename
and here you go ... I guess it will work on any with a /proc ;-} but
you do have to be root for it work unfortunately ...
#!/usr/bin/perl -w
# fuser.pl
# A simple minded fuser command
# may only work for Linux 2.0.34
use strict;
use Getopt::Std;
my %opt;
getopts('u',\%opt) || die "Invalid argument\n";
$ARGV[0] || die "No file specified \n";
my $rc = 0;
while(my $file = shift @ARGV)
{
next unless -f $file;
my @procinfo = ();
my ( $dev,
$ino,
@ostuff ) = stat($file);
while(</proc/*/fd/*>)
{
if (my @statinfo = stat)
{
if (($dev == $statinfo[0]) && ($ino == $statinfo[1]) )
{
my $user = '';
m{/proc/(\d+)/fd/\d+} && (my $pid = $1);
if ($opt{u})
{
$user = '(' . getpwuid((lstat($_))[4]) . ')';
}
push @procinfo, "${pid}${user}";
$rc++;
}
}
}
print "${file}:\t",join( "\t",@procinfo),"\n" if @procinfo;
}
exit $rc;
__END__
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Tue, 19 Oct 1999 22:08:10 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: help for functioin fork under win98
Message-Id: <eZ5P3.1621$IZ5.24874@news.rdc1.ct.home.com>
Scott McMahan <scott@aravis.softbase.com> wrote:
> As I was finishing it, ActiveState announced the goal was to make the
> next release of Perl support fork(). I don't understand how they're
> going to do it exactly, but it apparently involves cloning the running
> interpreter itself in a new thread or process. It's going to be
> hairy, whatever they come up with. It's certainly possible, since Perl
> is an interpreter, to do stuff you couldn't do in C.
One of the things you probably *won't* be able to do with the fork-enabled
perl on Win32 (or VMS, or the Mac, or any other non-forking platform) is
the standard fork and exec. Oddly enough that actually could work
now on VMS if we enabled a few bits, though that won't help anyone on
a windows platform...
Dan
------------------------------
Date: Tue, 19 Oct 1999 19:48:06 GMT
From: Dean J. Pompilio <dean_j_pompilio@yahoo.com>
Subject: HELP!! Pattern match stops before end of input
Message-Id: <7uihti$qfe$1@nnrp1.deja.com>
I am writing a script to parse the output of a HP-UX utility called
'ioscan'. I have set up a filehandle and the proper (I think so,
anyways...) pattern matching expression.
If I try to print $_ I can see the entire 'ioscan' output as expected.
My pattern match only returns the first line of the 'ioscan' output.
Btw, I have included some of the 'ioscan' output for reference. The
info I am parsing for is on two lines, which may be part of my problem.
The device files should be the only thing on the second line, if your
display shows otherwise...
IOSCAN OUTPUT:
----------------------------------------------------
disk 279 8/0.8.0.18.0.1.0 sdisk CLAIMED DEVICE
EMC SYMMETRIX
/dev/dsk/c19t1d0 /dev/rdsk/c19t1d0
disk 280 8/0.8.0.18.0.1.1 sdisk CLAIMED DEVICE
EMC SYMMETRIX
/dev/dsk/c19t1d1 /dev/rdsk/c19t1d1
----------------------------------------------------
PERL CODE:
----------------------------------------------------
#!/usr/bin/perl
open( IOSCAN, "ioscan -knfC disk \| grep -v \"Class\" \| grep -v \"=\"
|")
or die "Can't run 'ioscan -knfC disk': $!\n";
#open( OUTFILE, "> diskspace.out" ) or die "Can't save output: $!\n";
undef $/;
while(<IOSCAN>) {
if(
/disk\s+\d+\s+(\S+)\s+sdisk\s+CLAIMED\s+DEVICE\s+(\S+)\s+(\S+)\s+(\S+)\s
+(\S+)/ )
{
$hwpath = $1;
$make = $2;
$model = $3;
$devfile = $4;
$rdevfile = $5;
print "$hwpath \t $make \t $model \t $devfile \t
$rdevfile";
}
} close IOSCAN;
----------------------------------------------------
If anyone can help me figure out how to search the rest of the input
stream, it would be much appreciated!!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 17 Oct 1999 16:37:08 -0700
From: Jeff Moser <agon@unm.edu>
Subject: I pass by reference, but my array is unchanged.
Message-Id: <380A5DA4.4F4DA50A@unm.edu>
# I want to pass an array reference to a gah() and have gah()
# make changes to the array. Since the array is being passed
# by reference, I expect that any changes made in gah() will
# actually occur to @blorg in subroutine blah(). That's not
# what is happening though.
# The output of this program is
# a
# b
# c
# a
# b
# c
# I expected the output of this program to be:
# a
# b
# c
# 0
# 1
# 2
#!/usr/bin/perl -w
use strict;
blah();
exit 0;
sub blah()
{
my @blorg = ("a","b","c");
gah(\@blorg);
my $i;
for $i (0 .. $#blorg){
print "$blorg[$i]\n";
}
}
sub gah()
{
my $foo = shift;
my @arr = @$foo;
my $i;
for $i ( 0 .. $#arr ){
print "$arr[$i]\n";
$arr[$i] = $i;
}
}
# Thanks a lot for the help.
------------------------------
Date: Tue, 19 Oct 1999 13:47:44 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: I pass by reference, but my array is unchanged.
Message-Id: <380CD8F0.B4873EF6@cisco.com>
Jeff Moser wrote:
> my @arr = @$foo;
You made a copy of the array passed to the function
here. Then you made changes to it.
--
------------------------------
Date: 19 Oct 1999 20:38:12 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: linux perl editor?
Message-Id: <7uikrk$8h1$1@gellyfish.btinternet.com>
On Tue, 19 Oct 1999 12:39:39 -0500 Marc H. Robards wrote:
> Anyone have any recommendations for a perl editor under Linux? Or is emacs
> or vim the way to go? I've just started using Linux, so any suggesstions
> would be appreciated.
>
Yes vi,vim,nvi,elvis,emacs,joe,ev,pico,textedit,xedit,ptked will do fine.
Of course real programmers use 'dd'
gellyfish@gellyfish:/home/gellyfish/clpmtest > dd if=/dev/tty of=wowee && perl wowee
print "Please see <http://www.perl.com/reference/query.cgi?editors>\n";
0+1 records in
0+1 records out
Please see <http://www.perl.com/reference/query.cgi?editors>
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Tue, 19 Oct 1999 11:42:25 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Manipulating variables
Message-Id: <1h3iu7.4sc.ln@magna.metronet.com>
APS (pollayil20@yahoo.com) wrote:
: Where, $n_weight and $charge are taken from a flt. file db., for eg:
^^^^
Laziness would suggest that abbreviations are a Good Thing.
It is customary though, for abbreviations to be *shorter*
than the thing they abbreviate.
Why do you use the four characters "flt." (I don't know
what a "flight file db" is anyway).
It can't be that you are using it to "shorten" the
four characters "flat".
So, what does "flt." stand for?
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 19 Oct 1999 15:11:13 -0500
From: Craig Keefner <keefner@kinetic.com>
Subject: Re: Monitoring the clicks of a banner
Message-Id: <380CD061.D126C9AC@kinetic.com>
Kendar wrote:
> Does anyone know of any script that would monitor
> the clicks on a given banner? I have CGI access.
> Thank you in advance!
>
> medusa@beaute.org
you could use the file below. in the html page when you set the a href
for the banner do it like this
<a href=/cgi-bin/pass?path=http://whererever.youare.suppsedto
go.com><img src=yourbanner.gif></a>
then any decent stats package (analog comes to mind) will track your
redirects in your log files for you..
Craig
#!/usr/local/bin/perl
#
# passthrough.pl 4/20/98 1.4
#
######################
# Purpose: redirect URL while making sure that
# reference appears in usage log
# specific files are symlinked to this file
use CGI ":cgi";
$url = param('path');
# verify web address & format
# format is common type url with optional path
$url = "http://$url" if ($url !~ /^http:\/\//i);
$url = "http://www.xxxx.com"
if ($url !~
/^http:\/\/[\w-_\.]+\.(?:com|org|net|gov|edu|\w{2})(?:\/[\w-_\.\/?&=]*)?$/i);
# send them there
print "Location: $url\n\n";
------------------------------
Date: 19 Oct 1999 16:03:04 -0400
From: dha@panix.com (David H. Adler)
Subject: Re: need cgi script
Message-Id: <slrn80pjjn.ova.dha@panix.com>
On Mon, 18 Oct 1999 20:10:34 GMT, Mike Salter <msalter@bestweb.net> wrote:
>On Mon, 18 Oct 1999, T. Wilson wrote:
>TW>Willing to pay for:
>TW>I need a simple autoresponder as follows:
>TW>1. the user fills out an online form
>TW>2. the form data is sent to a specified email address
>TW>3. the user recieves a confirmation email
>
>Go to Yahoo and search on formmail, as this is the standard script as I
>recall for doing this sort of thing. If the author doesn't charge for it,
>send him a donation or something.
No. Do not do this. The first link yahoo gives (unsurprisingly) is
for the almost universally loathed (among those who know much about
perl, anyway) formmail script from Matt's Script Archive. This is a
bad thing.
I will leave it to you to check the archives of messages from this
newsgroup for why Matt's scripts are a *bad* idea. (y2k and security
problems spring to mind hanidly. :-/ )
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"There is a thin line between genius and insanity - I have erased that
line." - Oscar Levant
------------------------------
Date: Tue, 19 Oct 1999 19:10:43 GMT
From: jspangen@my-deja.com
Subject: Re: Newbie regex question on quoting
Message-Id: <7uifn8$p1b$1@nnrp1.deja.com>
In article <7uiag1$l24$1@nnrp1.deja.com>,
jhagerty@my-deja.com wrote:
> Reading the Perl doc's it appears that I should be able to substitute
> the asterisks out by quoting the metacharacter out. This is what I am
> trying to do with:
>
> $string =~ s/\*//gs;
>
> However, this is matching the entire string and leaving me nothing.
Your substitute is correct, my test prog (see below) works fine.
The error might be before that line, give me some more of your code.
my $test;
$test = shift or $test = "*test*\ntest***2**";
print "before sub = $test\n";
$test =~ s/\*//gs;
print "after sub = $test\n";
exit(0);
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 19 Oct 1999 11:56:39 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Newbie regex question on quoting
Message-Id: <nb4iu7.6uc.ln@magna.metronet.com>
jhagerty@my-deja.com wrote:
: Some brainiac is the text that I am parsing decided to leave astersiks
: as a marker. I don't want the marker so i need to strip out the
: asterisks.
: Reading the Perl doc's it appears that I should be able to substitute
: the asterisks out by quoting the metacharacter out. This is what I am
: trying to do with:
: $string =~ s/\*//gs;
That looks fine to me.
Except you shouldn't just randomly throw options onto the
end like that.
s///s affects only the dot character in the pattern, but
you don't even _have_ a dot in your pattern...
: However, this is matching the entire string and leaving me nothing.
I don't believe you.
Show some short and complete code that does what you are observing.
Works fine for me (except you should be using tr/*//d for that...)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 19 Oct 1999 21:02:10 GMT
From: nospam@today.com (Gordon)
Subject: Re: Newbie regex question on quoting
Message-Id: <36452.5826617977BAjustooltries@4.22.39.85>
jhagerty@my-deja.com wrote in
<7uiag1$l24$1@nnrp1.deja.com>:
>Some brainiac is the text that I
>am parsing decided to leave astersiks
>as a marker. I don't want the marker
>so i need to strip out the
>asterisks.
>
>Reading the Perl doc's it appears
>that I should be able to substitute
>the asterisks out by quoting the
>metacharacter out. This is what I am
>trying to do with:
>
>$string =~ s/\*//gs;
>
>However, this is matching the entire
>string and leaving me nothing.
>
>Help?
No idea, works just fine for me:)
-- Gordon --
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 1120
**************************************