[7501] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1127 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 4 21:07:06 1997

Date: Sat, 4 Oct 97 18:00:38 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 4 Oct 1997     Volume: 8 Number: 1127

Today's topics:
     Another Perl vs C question (John Armsby)
     Re: array assignment problem. <russ@mail.org.uk>
     Filehandle to file name? (John Moreno)
     Re: Filehandle to file name? (Tad McClellan)
     Re: Help... <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
     Re: Help: Regular Expression Substitution (Tad McClellan)
     How can I write an pixel to the browser? <jakob.vad.nielsen@manpower.no>
     Re: New to Perl - How to get Windows version <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
     Re: Newbie ques: How to concatenate two strings? <flavell@mail.cern.ch>
     Re: Newbie ques: How to concatenate two strings? (dave)
     Re: Newbie ques: How to concatenate two strings? (dave)
     Re: perl modem access jim@buttafuoco.mv.com
     perl: getting started (Samurai929)
     Re: perl: getting started (Mike Stok)
     Question about module installation plambert$1@plambert.org
     Re: splitting problems <mfoster@comp.uark.edu>
     telnet <support@huron.net>
     Re: Turning a formmated string into a list (James Weisberg)
     Re: Wanted: Wall/Schwartz book (1st ed) <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
     Re: Wanted: Wall/Schwartz book (1st ed) <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
     Why don't 'require' variables count towards "used only  (Felix Morley Finch)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 04 Oct 1997 23:55:57 GMT
From: jaws@atl.mindspring.com (John Armsby)
Subject: Another Perl vs C question
Message-Id: <616lav$q9t@camel18.mindspring.com>

Please forgive this question but I have not read the "answer" so I
must ask the question...

I have embraced perl to implement cgi scripts with one exception.  I
have a 3-4 meg ascii file which is 'searched' by the user inputing a
query string which I 'strstr' one line at a time.  When there is a
string match, the script spits back the line in html...  This script
is invoked approximately 2,000 times a day on a sun sparc 20 with 128
megs of ram.  The entire script is probablly only about 300 lines or
so.  If I had written it in Perl, it would probably be a third of the
size...  All the C script does is parse a single input from a form,
make it lower case, read the 3-4 meg file a line at a time, make each
line lower case as it reads it, compares the lower case query within
the line, and spits out html if there is a match anywhere along the
line.

I recently upgraded the C code with incredible pain and suffering to
output  a simple html table.  In perl this would have been trivial.
In C (since I have become rusty) it was exceedingly unpleasant.

I stuck with the C because I need speed to spit out the html.  I
thought (true or false) that Perl compiling would slow things down.  I
also have been afraid that all those Perl compilations by the users
would put extra pressure on the hard disks.  It seems that the C
script remains in ram...  Right now the user starts to see html on his
browser within a couple of seconds...

Are there any comments on this simple script as to whether i should
rewrite the script in Perl  and forsake C or stick to C?  Is there a
technical reason here or does it boil down to what is easiest for  me?


John Armsby



------------------------------

Date: Sat, 04 Oct 1997 13:13:43 +0100
From: Russell Odom <russ@mail.org.uk>
Subject: Re: array assignment problem.
Message-Id: <343632F7.25F2F81E@mail.org.uk>

Doug wrote:
> 
> [...] I'm using the 'edit' text editor in Win95.   Surely I would see
> any mis-typed chars?   I think I'll switch editors...

Try 'Programmer's File Editor' from
http://www.lancs.ac.uk/people/cpaap/pfe/

HTH,

Russ

---------------------------------------------------------------------
--[ R u s s e l l    O d o m ]---[ *NEW:* mailto:russ@mail.org.uk ]--
--[  University of York, UK  ]---[ http://www.york.ac.uk/~rjo100/ ]--
---------------------------------------------------------------------
--[    FAQ maintainer, news:comp.os.ms-windows.win95.moderated    ]--
---------------------------------------------------------------------



------------------------------

Date: Sat, 4 Oct 1997 17:31:56 -0400
From: phenix@interpath.com (John Moreno)
Subject: Filehandle to file name?
Message-Id: <19971004173156882088@roxboro-173.interpath.net>

Recently I wanted to delete a file using the filehandle.  I found a work
around so that I didn't need to do this, but is it possible?  Or is it
possible to get the file name from the filehandle?

-- 
John Moreno


------------------------------

Date: Sat, 4 Oct 1997 18:15:47 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Filehandle to file name?
Message-Id: <3ni616.vl2.ln@localhost>

John Moreno (phenix@interpath.com) wrote:

[ snip ]


: Or is it
: possible to get the file name from the filehandle?


What filename should it return for these?


   STDIN       # keyboard

   open(PIPE, "foobar |");


Filehandles might not correspond to any filename...


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


------------------------------

Date: Sat, 4 Oct 1997 11:56:35 -0700
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: Help...
Message-Id: <6163h4$s2t@bgtnsc02.worldnet.att.net>

It's OK, we were all new once. :D

You might try something like this and see if it works for you:

$s = $ENV{HTTP_REFERER};
$s =~ q!http://www.works.com/(.*?)cgi-bin/add2.cgi!;
$t = $1;
$t =~ s!/$!!;
if ($t eq "") {$t = "works"}
$recipient = "shop\@$t.com";

This takes a look at the HTTP_REFERER to see where the request cones from
and assigns whatever's between "www.works.com" and "cgi-bin" to the variable
$t via the match variable $1, then strips a slash it will (hopefully, unless
something's wrong) find at the end. If there's nothing in $t, it uses a
default of "works." Finally, it sets the variable $recipient according to
what it determined $t was. (One nice thing about this is that "works" gets
assigned by default, so you'll be able to see if something went awry in
setting the environment variable.)

Oh, and remember, you have to use "eq" instead of "=" when you're dealing
with strings. HTH!

--- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl

Mary Wilson wrote in message <6143a3$2et$1@news.northwest.com>...
> I have a statement in my paths.cgi
>that states
>$recipient= ( and here you put the e-mail of the recipient)
>but I want the recipient to change depending on were the director
>is that the person is using to execute the program...
>
>this is an idea I have .....
>any help would be great for I am new at this....
>
>
>
>
>$recipient =  'shop@works.com';
>  if ( $ENV{'HTTP_REFERER'}) eq= "http://www.works.com/cgi-bin/add2.cgi;
> elsif ( $ENV{'HTTP_REFERER'})
>eq="http://www.works.com/fmz/cgi-bin/add2.cgi;
>$recipient = 'shop@fmz.com';
>  elsif (  $ENV{'HTTP_REFERER'})
>eq="http://www.works.com/inter/cgi-bin/add2.cgi;
>$recipient = 'shop@inter.com';
>
>my email... hountz@diningtable.com
>
>
>




------------------------------

Date: Sat, 4 Oct 1997 15:39:44 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Help: Regular Expression Substitution
Message-Id: <gi9616.362.ln@localhost>

kai@webexpert.net wrote:
: Mike,
:   Yes!  That answer and link was really helpful.  I just wished I had seen
: it before I plunged hours of work, testing and revising into reinventing
: the wheel.  And when I couldn't understand what Jeffery Friedl was trying
: to do with that awfully complex expression, I bought his book, which is
: also really helpful.

:   However, like all learning experiences, it also raises more questions:
:  1) Why didn't putting a (g) at the end of the regular expression parse
: out all comments.  Why did I have to resort to using a while loop?


What while loop?

I don't see one here, so I cannot help with this Q.


:  2) Mr. Friedl, on page 169, talks about positive and negative-lookahead
: and how that's used because we can't match 2 characters at once.  So I
: can't write an expression like [^(\*\/)] to signify "not end of comment"?

That is right. Writing that will not get you what you want (and I do not
see any lookahead there either).

You should be aware of the difference between a regular expression and
a 'character class' within a regex.

What you have there is a character class, because you have enclosed it
in square brackets.


Inside of a character class there are very few special characters.

Slash and asterisk do not need to be escaped in char classes, because
they do not have any special meaning there. They just stand for themselves.

Parenthesis too, are not special, and stand for themselves.

A char class matches *one* character. You need to put a quantifier
after it if you want it to match more than a single character.

So, this:   [^)/(*]   will match *exactly* the same things that your
char class above will match (matches any single character that is
not one of those four characters).

Not what you want, I'm guessing.


:  3) Anyone have any thoughts of how to parse out comments in PERL?!? :-P
: Comments are started with #, unless if # are within quotes or regular
: expression delimiters... unfortunately, those delimiters can be ANYTHING
: as long as the regular expression starts with m, s, y, tr,... anything
: ELSE?! This becomes especially strange if I can't say: $CurLine =~
: /=~\s*[smy(tr)]?(.)/; $delimiter =$1; # or is it $2?!?	but if beginning
        ^^^^^^^^^

Here you are doing it again (not understanding char classes).

I think this will actually do what you were intending that char class to do:

(?:[smy]|tr)

will match any of:

   's'
   'm'
   'y'
   'tr'

without affecting the counting of the $digit variables [  (?:  )
style parenthesis give you grouping *without* triggering the saving
of the matched text in a $digit var.


In your regex above, the delimiter will be in $1, because the parens
in the char class are just literal parens. You have only one set of
'memory' parenthesis in there (the ones at the end).


Note also that your approach above will not work on these statements:

m{foobar};  # matching against $_ does not require the binding operator (=~)

split /foobar/, $str;  # never has a binding operator to key on...


: delimiter is {, isn't the end delimiter }?!?


Yes.


:   I'm going so nuts over trying to do all this... ugh.


Yep, that is to be expected.

This is not a simple problem you are tackling...

You need to really parse the perl grammar. Regexs alone are not
sufficiently powerful to do this right.

Using only regexs, the best you can claim is that it "works often",
not that it "always works correctly".



: In article <60lt7q$ib9@news-central.tiac.net>,
:   mike@stok.co.uk (Mike Stok) wrote:
: > >Please help, and cc a copy to my e-mail at kai@webexpert.net.
: > >Thank you.
: > >4) /*comment1*/ print "Hello World!\n"; /*comment2*/ print "Hello Again!\n";
: > >
: > >and the code I intended to use was:
: > >
: > >$Curline =~ s/^([^"\n]*(".*")*[^"\n]*)\/\*[^(\*\/)\n]*\*\//$1/g;
: >
: > You might try the solution suggested in the FAQ at
: >
: >
: http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfaq6/How_do_I_use_a_regul
: ar_expresio.html


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


------------------------------

Date: 4 Oct 1997 19:21:23 GMT
From: "jakob" <jakob.vad.nielsen@manpower.no>
Subject: How can I write an pixel to the browser?
Message-Id: <01bcd0fb$32f02960$3b0c4bc1@J.Jakob>

How can I easy write an image to the browser. I only need writing a white
pixel
to the browser. ( 1x1 pixel ) The reason is that I am using the <img
src=...> tag to
run a counter script. I can't run SSI comands on the server.


jakob.vad.nielsen@manpower.no


------------------------------

Date: Sat, 4 Oct 1997 12:45:03 -0700
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: New to Perl - How to get Windows version
Message-Id: <6166c4$a9j@bgtnsc02.worldnet.att.net>

Run, do not walk, to

http://www.activeware.com

and pick up the Activeware port. I am currently using it on my home Win95
machine and have had absolutely no problems with it. Use Winzip to unzip and
extract it, and install.bat will place all of the registry entries that make
using Perl a lot easier on Win95.

I also recommend PFE (http://www.lancs.ac.uk/people/cpaap/pfe/) as a
freeware editor that has Notepad beat all hollow.


Steinar Kleven wrote in message <34365691.F907B490@ahs.hist.no>...
>Try http://www.perl.org/CPAN/ports/win32
>
>There are two releases there: Standard and NOT Standard ;-)
>
>Greg Teets wrote:
>>
>> I am using Perl at work on UNIX.  I'd like to fool around with it at
>> home on a Win95 box to get more familiar with it.  Please let me know
>> where I can get a port for Win95.
>>
>> Thanks
>> Greg Teets
>> Cincinnati, Ohio




------------------------------

Date: Sat, 4 Oct 1997 21:30:01 GMT
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Newbie ques: How to concatenate two strings?
Message-Id: <Pine.A41.3.95a.971004231957.115778N-100000@sp051>

On Thu, 2 Oct 1997, Koll Simonds wrote:

> Ah, you grovel and genuflect to those who know more (the perl way) and you
> still get your chops busted for asking a newbie question. 

Not the point.  I'm a relative newbie to Perl, but when I formulate
a question then the first thing I do is consult the freely accessible
documentation for an answer.  

Grovelling and genuflecting are not seen as substitutes for RTFM, and
rightly so.  Posting to usenet is far too easy.

> Makes Microsoft seem downright warm & fuzzy.

If you prefer warm fuzzy confusion over hard facts then perhaps
you'd be happier there.

It remains true that the major enemies of any usenet group are those who
leap to post a question before trying the slightest alternatives, such
as RTFM, checking online resources, breaking the problem down into
simple test cases, etc.  Second in line are those who defend such stupid
actions rather than trying to help them overcome their stupidity. 

Given enough of those, the really useful participants will go away; it's
in the interest of all of us to keep them from going away. 




------------------------------

Date: Sat, 04 Oct 1997 23:11:05 GMT
From: over@the.net (dave)
Subject: Re: Newbie ques: How to concatenate two strings?
Message-Id: <3436cbbb.700238@news.one.net>

Doug Seay <seay@absyss.fr> wrote:


>I didn't think you were using Unix because no Unix user would complain
>about "man | grep", even if using some all inclusive GUI.  Dunno 'bout
>Win95, but WinNT comes with an ugly DOS box that supports "find" which
>allows you to look in files for strings so you can do the same sort of
>thing.  The flexiblity of the command line for doing things like this is
>why most of us don't switch to all GUI systems.

The perl man pages put too much on one page to be as useful as other UNIX
pages.  Looking up something on perl is like looking up something on ksh.
Arghhh!


Get the Camel book and/or use the hyperlinked HTML.

Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________


------------------------------

Date: Sat, 04 Oct 1997 23:00:34 GMT
From: over@the.net (dave)
Subject: Re: Newbie ques: How to concatenate two strings?
Message-Id: <3436ca50.336964@news.one.net>

tadmc@flash.net (Tad McClellan) wrote:


>Do you see how folks might get annoyed to see it yet again?

Then let someone else answer them.

Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________


------------------------------

Date: Sat, 4 Oct 1997 21:03:18 GMT
From: jim@buttafuoco.mv.com
Subject: Re: perl modem access
Message-Id: <616aum$jhf@gateway.buttafuoco.net>

Hi,
	I have written a simple perl program that talks to a modem. Please send any changes back to me.


Thanks 
Jim


#!/usr/bin/perl -w

use strict;
use POSIX;
use FileHandle;

# use POSIX::Termios;

sub PerlMain
{
    my($bytes,$buf);
    my($timeleft);
    my($tserial,$tterm,$sterm);
    my($cflags,$oflag,$iflag,$lflag);
    my($fdserial,$fdterm);
    my($rin,$win,$ein) = (0,0,0);
    my($rout,$wout,$eout) = (0,0,0);
    my($nfound);
    my($buf) = '';
    my($x);

    
    $fdserial = POSIX::open("/dev/cua0",O_RDWR|O_NONBLOCK);
    if($fdserial < 0)
    {
	die "Error opening /dev/cua1\n";
    }

    $fdterm = POSIX::open("/dev/tty",O_RDWR);
    if($fdterm < 0)
    {
	die "Error opening /dev/cua1\n";
    }


    $tserial = new POSIX::Termios;
    $tserial->setiflag(IGNBRK | INPCK);
    $tserial->setoflag(0);
    $tserial->setcflag(CS8 | CREAD | CLOCAL | CSTOPB);
    $tserial->setlflag(0);
    $tserial->setispeed(B38400);
    $tserial->setospeed(B38400);
    $tserial->setattr($fdserial,TCSANOW);

    $tterm = new POSIX::Termios;
    $sterm = new POSIX::Termios;
    $tterm->getattr($fdterm);
    $sterm->getattr($fdterm);
    $tterm->setiflag(0);
    $tterm->setlflag(0);
    $tterm->setcc(VTIME,0);
    $tterm->setcc(VMIN,0);

    $tterm->setattr($fdterm,TCSANOW);


    while(1)
    {
	my($bytes,$buf);
	my($timeleft);
	$rin = '';
	vec($rin,$fdterm,1) = 1;
	vec($rin,$fdserial,1) = 1;

	($nfound,$timeleft) = select($rout = $rin,undef,undef, 10);

	if(vec($rout,$fdterm,1))
	{
	    $bytes = POSIX::read($fdterm,$buf,256);
	    last if $buf =~ /^~/;
	    POSIX::write($fdserial,$buf,$bytes);
	}


	if(vec($rout,$fdserial,1))
	{
	    $bytes = POSIX::read($fdserial,$buf,256);

	    if($buf)
	    {
	      POSIX::write($fdterm,$buf,$bytes);
	    }
	}

    }

    $sterm->setattr($fdterm,TCSANOW);
    exit(0);
}

PerlMain();

david@barnworth.com wrote:
: Hi.

: dbruyne@uia.ua.ac.be (Karel.DeBruyne) wrote:
: >I've got a unix box (linux or solaris) with a modem.
: >I want to have my perl-program send some string to the modem, to
: >setup a dialout session. Than, I want to read from this modem to
: >get the replies.
: >
: >How can I do this in perl ?

: I am having the same trouble on my linux machine.  Can't believe there's
: nothing in any PERL documentation on simple serial communications.

: I found the same "talk-to-modem.pl" script, but it did not run out of the
: box.  After modifying it a bit, I got it to send hayes commands, but I
: still can't read from the modem.  I'll keep playing with it, but there
: must be someone out there who knows how to make this work!!!??

: - David

: --
: #!/usr/bin/perl

: $modem = "/dev/modem";
: $number = "5551212";               # set to something that will ring

: open(MODEM, "+>$modem") || die "Can't open $modem\n";
: #system("stty -echo raw >/dev/cua0");# this line makes my machine hang

: $out = "ATDT$number\r";            # let's try something simple

: syswrite(MODEM,$out,length($out)); # could also do non-buffered "print"
: sleep(10);                         # wait for modem to respond
: sysread(MODEM, $in, 1000);         # better than $i = <MODEM>
:                                    # since it gets all data at
:                                    # once, including extra newlines,
:                                    # but doesn't hang, like @i = <MODEM>;

: print "($in)\n";

: if ($in =~ /OK/ ) {                # do this instead of $in eq "OK"
:                                    # because modem may send other junk
:         print "OK received\n";
: } else {
:         print "OK NOT received\n";
: }

: close MODEM;
: exit;
: --


: -------------------==== Posted via Deja News ====-----------------------
:       http://www.dejanews.com/     Search, Read, Post to Usenet


------------------------------

Date: 4 Oct 1997 20:35:21 GMT
From: samurai929@aol.com (Samurai929)
Subject: perl: getting started
Message-Id: <19971004203500.QAA08709@ladder02.news.aol.com>

what is a good book to get started w/ perl? are there any resources online?

Please cc: your response, if possible, so that I don't miss it.
Thanks a lot for your help.

samurai929@aol.com


------------------------------

Date: 4 Oct 1997 22:13:43 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: perl: getting started
Message-Id: <616f2n$qg5@news-central.tiac.net>

http://reference.perl.com/query.cgi?books

Might be useful.  O'Reilly's book Learning Perl seems as good as any to
begin with.

Mike

In article <19971004203500.QAA08709@ladder02.news.aol.com>,
Samurai929 <samurai929@aol.com> wrote:
>what is a good book to get started w/ perl? are there any resources online?
>
>Please cc: your response, if possible, so that I don't miss it.
>Thanks a lot for your help.
>
>samurai929@aol.com


-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


------------------------------

Date: 4 Oct 1997 21:26:30 GMT
From: plambert$1@plambert.org
Subject: Question about module installation
Message-Id: <616ca6$ac8$1@nntp1.ba.best.com>

I'm working on a project I'd like to write in perl, but which requires
quite a few modules, including perl/tk, ARSPerl, etc, to be installed as
"unsupported" for our userbase.  If I can't do this with perl, I'll be
forced to write the project in tcl, which is _not_ the right tool for the
job, but which would be my only option, since it is a supported package.

Specifically, we have perl installed at our site in one place, and I need
to install the modules in another, and force users to add something to
@INC before using the modules, to make the point that they are 
unsupported:

% which perl
/usr/nas/bin/perl
% ls -l /usr/nas/bin/perl
lrwxrwxrwx   1 root           26 Oct  2 18:17 /usr/nas/bin/perl -> ../pkg/perl/5.004/bin/perl
% perl -e "print join(',',@INC);"
/usr/nas/pkg/perl/5.004/lib/sun4-solaris/5.00401,/usr/nas/pkg/perl/5.004/lib,/usr/nas/pkg/perl/5.004/lib/site_perl/sun4-solaris,/usr/nas/pkg/perl/5.004/lib

Anything I install must be placed in its own package directory and linked
into perl with symlinks.  The package directory will be under
/usr/unsupported/pkg/<modulename>/<version>/whatever...

I've been using perl for quite some time, but have never needed to install
modules other than the "perl Makefile.PL; make; make install" method, which
works _so_ much better.  ;-)

Is there an easy way to put modules in an unusual place like this?  Can
someone suggest a way to make this whole process easier?  (I'll be installing
a _lot_ of modules this way...)  

What I'd really like to do is this:  put each module into its own pkg
directory, with the modulename and version number, and then put symlinks
into a /usr/unsupported/pkg/perllib or something similar, to allow a
single "push @INC,'/path/lib';" to allow access to _all_ of the unsupported
modules at once.

Any pointers would be appreciated.  I've dug through the FAQ's, and haven't
found much of the information I'm looking for.

Many thanks to anyone that can help me in any way.

--Paul Lambert



------------------------------

Date: Sat, 4 Oct 1997 17:46:29 -0500
From: Matt Foster <mfoster@comp.uark.edu>
To: Brent Brookler <brent@tzn.com>
Subject: Re: splitting problems
Message-Id: <Pine.SOL.3.95.971004174350.10747B-100000@comp>

// I am trying to seperate the numbers from an IP address like so:
// [snip]
// $ipaddr = "$ENV{'REMOTE_ADDR'}";
// @fields = split(/./,$ipaddr);
//       $ip1 = $fields[0];
//       $ip2 = $fields[1];
//       $ip3 = $fields[2];
//         $ip4 = $fields[3];            

  Read up on regular expressions.  (See the man page regexp(5).)
Quoting: "A period (.) is a one-character RE that matches any character
except new-line."  You need to escape the period if you want to use
it literally.  So, change split(/./,$ipaddr) to split(/\./,$ipaddr).
Best,

   mwf




------------------------------

Date: Sat, 04 Oct 1997 20:32:29 -0400
From: Huron Internet <support@huron.net>
Subject: telnet
Message-Id: <3436E01C.D189C998@huron.net>

I want to use PERL to telnet to a site, log on, execute a command & save
the results in a variable, then quit telnet.

Is this possible?

I can start the telnet program with something like:
$temp `telnet domain.com`
but how do I issue further commands?


Please post a reply or email to buck@huron.net
Thanks.





------------------------------

Date: 4 Oct 1997 16:39:46 -0500
From: chadbour@sashimi.wwa.com (James Weisberg)
Subject: Re: Turning a formmated string into a list
Message-Id: <616d32$mk@miso.wwa.com>
Keywords: chadbour@sashimi.wwa.com

In article <613dk8$3pq@news-central.tiac.net>,
Mike Stok <mike@stok.co.uk> wrote:
>In article <613clh$hsj@miso.wwa.com>,
>James Weisberg <chadbour@sashimi.wwa.com> wrote:
>>I have a fairly simple question. I would like to write a function
>>which takes a string of the form: MMDDYYhhmm.ext and returns a
>>list of each component. For example:
>>
>>$file="0903971430.txt"
>>
>>($MM, $DD, $YY, $hh, $mm, $ext) = filetolist($file);
>>
>>Can someone show me how to write this function in Perl? 
>
>If it's a fixed format then unpack is one way to do it e.g.
>
>  ($MM, $DD, $YY, $hh, $mm, $ext) = unpack ('a2a2a2a2a2xa*', $file);

Yeah, this is pretty much what I was looking for. It is a fixed
format, I should have mentioned that. 

>As this is perl, there is more than one way to do it...

I was hoping not to use the regex. That I knew how to do but 
this unpacking function will be called many times in the script
I am writing. I assume unpacking a fixed format string is much
faster than doing a pattern match with a regular expression.

Thanx.




------------------------------

Date: Sat, 4 Oct 1997 12:40:59 -0700
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: Wanted: Wall/Schwartz book (1st ed)
Message-Id: <61664b$9br@bgtnsc02.worldnet.att.net>

Oh. Well, I was considering swapping someone for a copy of the second
edition straight across, but now that I know this, I think I'll hang onto
mine. :D

Has anyone check to see if the missing code might by chance be on the
O'Reilly web site or on www.perl.com? If not, since the book is out of print
it might be a nice gesture for people who only have the second edition to
see what they're missing.

--- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl


Paul A Sand wrote in message <615fml$dkt@mozz.unh.edu>...
>dks@mediaweb.com (dk smith) writes:
>
>>Amcurious. Why is this sentiment held by so many? Is there some good
>>content in the 1st edition that did not appear in the 2nd?
>
>Yes. Most notably, a couple of chapters containing code snippets and
>complete scripts for performing useful tasks. I appreciate that the
>Perl5 Camel probably didn't have room for that content, and probably
>the authors didn't have time to Perl5-ify the code, and probably they
>wanted to make the book more clearly a reference tome than a tutorial,
>etc., etc.
>
>But it was great stuff, and fit in well with the rest of the book.  The
>new Camel is an invaluable, technically correct reference, but it has
>significantly less soul.
>--
>-- Paul A. Sand                 | I can't decide if I'm bragging or
>-- University of New Hampshire  | complaining.
>-- pas@unh.edu                  |     (Mary Loveless, rec.arts.books)
>-- http://pubpages.unh.edu/~pas |




------------------------------

Date: Sat, 4 Oct 1997 12:40:59 -0700
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: Wanted: Wall/Schwartz book (1st ed)
Message-Id: <6166bv$a9j@bgtnsc02.worldnet.att.net>

Oh. Well, I was considering swapping someone for a copy of the second
edition straight across, but now that I know this, I think I'll hang onto
mine. :D

Has anyone check to see if the missing code might by chance be on the
O'Reilly web site or on www.perl.com? If not, since the book is out of print
it might be a nice gesture for people who only have the second edition to
see what they're missing.

--- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl


Paul A Sand wrote in message <615fml$dkt@mozz.unh.edu>...
>dks@mediaweb.com (dk smith) writes:
>
>>Amcurious. Why is this sentiment held by so many? Is there some good
>>content in the 1st edition that did not appear in the 2nd?
>
>Yes. Most notably, a couple of chapters containing code snippets and
>complete scripts for performing useful tasks. I appreciate that the
>Perl5 Camel probably didn't have room for that content, and probably
>the authors didn't have time to Perl5-ify the code, and probably they
>wanted to make the book more clearly a reference tome than a tutorial,
>etc., etc.
>
>But it was great stuff, and fit in well with the rest of the book.  The
>new Camel is an invaluable, technically correct reference, but it has
>significantly less soul.
>--
>-- Paul A. Sand                 | I can't decide if I'm bragging or
>-- University of New Hampshire  | complaining.
>-- pas@unh.edu                  |     (Mary Loveless, rec.arts.books)
>-- http://pubpages.unh.edu/~pas |




------------------------------

Date: 4 Oct 1997 23:46:05 GMT
From: felix@crowfix.com (Felix Morley Finch)
Subject: Why don't 'require' variables count towards "used only once"?
Message-Id: <slrn63dlam.cak.felix@crowfix.com>

I have a main file, xyzzy.pl:

#!/usr/bin/perl -w
require 'xyzzy-lib.pl';
print $xyzzy1, "\n";
exit 0;

Then there's another, xyzzy-lib.pl:

$xyzzy1 = "1";
$xyzzy2 = "2";
1;

When I run ./xyzzy.pl, I get the complaint

Name "main::xyzzy1" used only once: possible typo at ./xyzzy.pl line 3.

I understood that I've only "used" it once; on the other hand, I've
only "used" $xyzzy2 not at all.

If I combine the two into a single file, I get more intelligent
behaviour:

#!/usr/bin/perl -w
$xyzzy1 = "1";
$xyzzy2 = "2";
print $xyzzy1, "\n";
exit 0;

Name "main::xyzzy2" used only once: possible typo at ./abc.pl line 3.

It makes it hard to see any real erros with all these bogus ones.

-- 
            ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
      Felix Finch, scarecrow repairer, rocket surgeon / felix@crowfix.com
            PGP = 91 B3 94 7C E9 E8 76 2D   E1 63 51 AA A0 48 89 2F
I've found a solution to Fermat's Last Theorem but I see I've run out of room o


------------------------------

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 1127
**************************************

home help back first fref pref prev next nref lref last post