[13443] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 853 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 20 06:07:20 1999

Date: Mon, 20 Sep 1999 03:05:10 -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: <937821910-v9-i853@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 20 Sep 1999     Volume: 9 Number: 853

Today's topics:
    Re: Are threads the way to go?  Design Advice (Anno Siegel)
    Re: Be careful about using constants (Bart Lateur)
    Re: Callin CGI from pull down - HELP ! (Burt lewis)
    Re: Can I call a compiled C program from Perl? <linyong2000@990.net>
    Re: CGI in PERL (Bart Lateur)
    Re: Converting time() to real date (Philip 'Yes, that's my address' Newton)
    Re: Error in "Learning Perl, 2nd Edition" or Error in P (Bart Lateur)
    Re: Help me please <gellyfish@gellyfish.com>
    Re: Help me please (Abigail)
    Re: Help me please <gellyfish@gellyfish.com>
    Re: Help me please (Sam Holden)
    Re: How to create files from CGI script? (I.J. Garlick)
    Re: List files in a dir (Bart Lateur)
    Re: NDBM_File problem. (Anno Siegel)
    Re: Newbie questions on list assignment <hove@ido.phys.ntnu.no>
    Re: Newbie questions on list assignment <hove@ido.phys.ntnu.no>
        Novice: network/web solution needed. <deantran@ix.netcom.com>
        Printing Hex output <Design@datacomm.ch>
    Re: Regulat Expressions and Tabulator Problems <wiseguy_73NOdjSPAM@go.com>
    Re: Regulat Expressions and Tabulator Problems (elephant)
    Re: Some e-mails get sent, some don't (I.J. Garlick)
        System Call only works on 4K of input <uli.brass@netcologne.de>
    Re: UNCRAP project proposal (Bart Lateur)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 20 Sep 1999 09:57:28 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Are threads the way to go?  Design Advice
Message-Id: <7s50e8$q7h$1@lublin.zrz.tu-berlin.de>

Dan Sugalski  <dan@tuatha.sidhe.org> wrote in comp.lang.perl.misc:
>Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>> Ilya Zakharevich <ilya@math.ohio-state.edu> wrote in comp.lang.perl.misc:

>>>Keep in mind memory considerations as well.  As experiments show,
>>>memorywise fork() gives almost no advantage over running separate Perl
>>>processes (14% difference reported on Solaris - with total footprint
>>>circa 9G).
>
>> Why *should* fork give a memory advantage?  Where does the 14% savings
>> come from anyway?
>
>Any memory page left untouched after the fork should stay shared between
>the parent and child processes, so, for example, the pages that hold the
>compiled perl program should share. Perl, unfortunately, tends to touch
>lots of memory so most of the memory your program uses ends up changing
>after the fork (either by the child or parent) so not much stays shared.

Oh... Copy On Write wizardry there.  Makes sense.

Anno


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

Date: Mon, 20 Sep 1999 09:15:09 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Be careful about using constants
Message-Id: <37eefb17.4781386@news.skynet.be>

John Lin wrote:

>Version II (my suggestion)
>
>use constant '$PI' => 4 * atan2 1, 1;
>print "The value of PI is $PI.\n";
>
>use constant '@USERINFO' => getpwuid($<);
>$homedir = $USERINFO[7];
>
>
>Constants with prefixes seem more natural than bareword
>and produce less trouble for both compiler and programmers.
>
>What do you think about it?

I agree. Constants are "variables", not "functions". 

This works for the scalar, and I think it behaves exactly as what you
would like:

	*PI  = \(scalar 4 * atan2(1,1));

$PI is a scalar, and works as a scalar, but it will complain if you try
to modify it.

For arrays, it's not that obvious. The scalars in the array are not
linked to a typeglob, so I would even know how to alias the values. A
second problem that would need a solution is that the array length must
be fixed.

-- 
	Bart.


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

Date: Mon, 20 Sep 1999 09:56:33 GMT
From: burt@ici.net (Burt lewis)
Subject: Re: Callin CGI from pull down - HELP !
Message-Id: <lxnF3.365$sa1.72911@news.goodnet.com>

In article <37E4ED75.82E26F0A@mail.idt.net>, andrij@mail.idt.net says...
>
>Hello all.
>
>I need some help and I was hoping some one here can give me some
>direction. I have a pull down menu which redirects the user to a
>different page when they hit submit  (depending on which option they
>have selected from the pull down). I am using the following template:
>
><form method="post" action="redirect.pl">
>
><select name="url">
><option selected=selected value="">Select one</option>
><option value=http://www.whatever.com/main.html>Whatever</option>
><option value=http://www.anything.com/main.html>Anything</option>
></select>
>
><input type="submit" value="Submit">
></form>
>
>Where redirect.pl is as follows:
>
>read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>
>@pairs = split(/&/, $buffer);
>foreach $pair (@pairs) {
> ($name, $value) = split(/=/, $pair);
> $value =~ tr/+/ /;
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>        $FORM{$name} = $value;
>}
>
>$url = $FORM{'url'};
>
>print ("Location: $url\n\n");
>
>exit;
>_______
>
>The problem I have is that I just realized I need to call cg scripts
>instead of just plain html pages in the pull down (eg. <option
>value=http://www.whatever.com/main.html> should instead be <option
>value=http://www.whatever.com/cgi-bin/script1.cgi>). The scripts I call
>gather information from the first first and keep the info as hidden
>fields. As you may have guessed, the cgi page is printed correctly, but
>none of the form information carries correctly, I suppose because the
>scripts are not called directly from the ACTION command.
>
>I am only just learning perl and cgi, so I need some help to make these
>run correctly, please help !  I appreciate in advance any help you can
>give, and please email if you can. Thanks again all !
>
>
>-Christine
>
>

Hi,

I would do something like:

<option value=1>Whatever</option>
<option value=2>Anything</option>

if ($FORM{'url'})
{
$url=$FORM{'url'}
}
if ($url == 1}
{
$go="http://www.whatever.com/main.html"
}

print ("Location: $go\n\n");

Hope this helps.

Burt Lewis





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

Date: Mon, 20 Sep 1999 15:09:49 +0800
From: "Daniel Y.L." <linyong2000@990.net>
Subject: Re: Can I call a compiled C program from Perl?
Message-Id: <7s4mkr$2sj$1@news.ntu.edu.sg>

Try:

$command = "./****";        #where, **** is your C program file name,
remember, there is the path;

open (PIPEFROM, "$command|);        #execute your C program to a PIPE;

while (<PIPEFROM>) {
    print $_;            # output the C program's results to STDOUT
}

close(PIPEFROM);

Hope it will help you.


Rocky <MrETS@inconnect.com> wrote in message
news:7s0lsd$dts$1@news.inconnect.com...
> Does anyone know how to call a compiled C executable
> from within a Perl program on a UNIX server.
>
> My executable C is in the same directory as my Perl Script.
>
> I have tried extensions . .out .exe and (no extension)
>
> I have "chmod" executable files to 755
>
> The executables run just fine if I telnet to the directory
> and just type their names from the command line...
>
> What Gives? - Val Patterson, SLC UT
>
>
>
>




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

Date: Mon, 20 Sep 1999 08:16:34 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: CGI in PERL
Message-Id: <37e7ed39.1231418@news.skynet.be>

Zenin wrote:

>: Dunno if I agree with some of those languages, esp BASIC... basic is often
>: spelt in caps. But the principal is right...
>
>	ONLY BECAUSE EARLY BASIC INTERPRETERS COULD ONLY DO CAPS, AFAIK.
>
>	Thank god they added lower case characters so we could all stop
>	yelling at each other. :-)

No no no. You just had to yell at the BASIC interpreter. A bit hard of
hearing, those things.

-- 
	Bart.


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

Date: Mon, 20 Sep 1999 04:52:08 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: Converting time() to real date
Message-Id: <37e5b72d.39950363@news.nikoma.de>

On 19 Sep 1999 13:40:21 -0500, abigail@delanet.com (Abigail) wrote:

>Since Perl is going to create a table of size 2^31, don't you think even
>a later perl5 is going to use quite some memory?

True. The only difference being between creating a table of size 2 GB
* n, or two tables of roughly that size (with the counting table being
smaller, presumably, since it stores only ints and not ref's to other
arrays).

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.net>


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

Date: Mon, 20 Sep 1999 09:31:20 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Error in "Learning Perl, 2nd Edition" or Error in Perl port specific to Windows or ?
Message-Id: <37edfac6.4700646@news.skynet.be>

Larry Rosler wrote:

>Calling this 'a bug waiting to happen' is the same kind of Puritan 
>argument...

Oh. Just change the formatting of the output and the sorting changes.
You call that a purtan argument? Fine.

Another example. Suppose you're sorting paths of a disk, both
directories and files. You try a straightforward alphabetical sort, and
it seems to work. And then:

    @files = ('/local/pub/files',
              '/local/pub/files/alpha.txt',
              '/local/pub/files/beta.txt',
              '/local/pub/files.txt',
        );
    ($\,$,) = ("\n","\n");
    print sort @files;
-->
    /local/pub/files
    /local/pub/files.txt
    /local/pub/files/alpha.txt
    /local/pub/files/beta.txt

Oops. The file "files.txt" appears between the directory "files" and
it's contents. And here's why:

    print sort ('/','.'); 
-->
    ./

Thinking it's safe to sort according to variable length (left part)
substrings, just by sorting the whole strings, is just buggy thinking.

Nothing wrong with it, if you're sorting fixed length substrings.

-- 
	Bart.


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

Date: 20 Sep 1999 09:36:32 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help me please
Message-Id: <37e5f210_2@newsread3.dircon.co.uk>

Abigail <abigail@delanet.com> wrote:
> Frenzyr (frenzyr@writeme.com) wrote on MMCCX September MCMXCIII in
> <URL:news:7s2agp$nc6$1@weber.a2000.nl>:
> () hia all, i have a question, i have a script and can't figure out why it's
> () not working
> () 
> () the permissions are set to 755 so that should be ok.
> () 
> () the script is as follows: please help me out here.
> () 
> () #!/usr/local/bin/perl
> 
> No -w
> No -T
> No use strict;
> No use CGI;
> 
> () $SENDMAIL="/usr/lib/sendmail -t";
> () 
> () $SUBJECT="Thank you";
> () $REPLYTO="info@blablabla.com;
>                  ^             ^
>                  |             |
> 
> () read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'});
> () @pairs = split(/&/,$buffer);
> () foreach $pair(@pairs) {
> () ($name,$value) = split(/=/,$pair);
> ()   $value =~ tr/+/ /;
> ()   $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> () $FORM{$name} = $value;
> () }
> 
> You should be using the routines from CGI.pm for this.
> As shown many times in this groups, the above is inadequate.
> 

Sam Holden <sholden@pgrad.cs.usyd.edu.au> wrote:
> On Sun, 19 Sep 1999 11:31:44 +0200, Frenzyr <frenzyr@writeme.com> wrote:
>>hia all, i have a question, i have a script and can't figure out why it's
>>not working
>>
>>the permissions are set to 755 so that should be ok.
>>
>>the script is as follows: please help me out here.
>>
>>#!/usr/local/bin/perl
> 
> No -w. 
> No -T on a CGI script.
> No use strict.
> 
> Maybe you should do all those things first and start again.
> 
>>
>>$SENDMAIL="/usr/lib/sendmail -t";
>>
>>$SUBJECT="Thank you";
>>$REPLYTO="info@blablabla.com;
>                ^              ^
> You could try reading the error message that these would generate...
> Of course you'll have to run it at the prompt not as a CGI...
> 
>>
>>read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'});
> 
> There is this thing called CGI.pm which will do what you are trying to 
> do. The bonus is it will actually work.
> 
>>@pairs = split(/&/,$buffer);
>>foreach $pair(@pairs) {
>>($name,$value) = split(/=/,$pair);
>>  $value =~ tr/+/ /;
>>  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>>$FORM{$name} = $value;
>>}
>>
>># split up the "to" names for multiple recipients
>>$TO=$FORM{'email'};
>>
>># Open Sendmail and do our thing
>>open (SENDMAIL,"| $SENDMAIL") || die "Ain't Gonna Happen";
>>print SENDMAIL "To: $TO\n";
>>print SENDMAIL "Subject: $SUBJECT\n";
>>print SENDMAIL "Reply-To: $REPLYTO\n";
>>print SENDMAIL "blablablabla\n";
>>close(SENDMAIL);
> 
> It might be good to seperate the headers from the body in the standard way.
> Reading the standard or some mail documentation will tell you how...
> 
> 

I am now beginning to suspect that Sam and Abigail are on and the same
person.

/J\
-- 
"If I was going to wear a wig I'd choose something a lot better than this"
- Barry Norman


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

Date: 20 Sep 1999 04:11:57 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Help me please
Message-Id: <slrn7ubuno.ae4.abigail@alexandra.delanet.com>

Jonathan Stowe (gellyfish@gellyfish.com) wrote on MMCCXI September
MCMXCIII in <URL:news:37e5f210_2@newsread3.dircon.co.uk>:
** 
** I am now beginning to suspect that Sam and Abigail are on and the same
** person.


Hmmm. I've been accused of being else so often, perhaps it's time to
define an 'Abigail number', kind of like an 'Erd\"{o}s number'.

  -  Abigail's Abigail number is 0.
  -  Anyone who was once suspected to be the same person as Abigail
     has an Abigail number of 1.
  -  Your Abigail number is N + 1, if the smallest Abigail number of
     the set of people who have been suspected to be the same person
     as you is N.



Abigail
-- 
               split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_)  {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 20 Sep 1999 10:29:11 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help me please
Message-Id: <37e5fe67_1@newsread3.dircon.co.uk>

Abigail <abigail@delanet.com> wrote:
> Jonathan Stowe (gellyfish@gellyfish.com) wrote on MMCCXI September
> MCMXCIII in <URL:news:37e5f210_2@newsread3.dircon.co.uk>:
> ** 
> ** I am now beginning to suspect that Sam and Abigail are on and the same
> ** person.
> 
> 
> Hmmm. I've been accused of being else so often, perhaps it's time to
> define an 'Abigail number', kind of like an 'Erd\"{o}s number'.
> 
>   -  Abigail's Abigail number is 0.
>   -  Anyone who was once suspected to be the same person as Abigail
>      has an Abigail number of 1.
>   -  Your Abigail number is N + 1, if the smallest Abigail number of
>      the set of people who have been suspected to be the same person
>      as you is N.
> 
> 

Oh dont my head hurts enough as it is ...  Anyhow I think Abigail and
Abigail are one and the same person thereby making making Abigail's
Abigail number infinite ...

/J\
-- 
"I sign my paintings Vincent because people can't pronounce Van Gough"
- Vincent Van Gough


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

Date: 20 Sep 1999 09:52:25 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Help me please
Message-Id: <slrn7uc0up.9vg.sholden@pgrad.cs.usyd.edu.au>

On 20 Sep 1999 10:29:11 +0100, Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>Abigail <abigail@delanet.com> wrote:
>> Jonathan Stowe (gellyfish@gellyfish.com) wrote on MMCCXI September
>> MCMXCIII in <URL:news:37e5f210_2@newsread3.dircon.co.uk>:
>> ** 
>> ** I am now beginning to suspect that Sam and Abigail are on and the same
>> ** person.

Missed this originally in a big catchup I suspect...

It's not true, but it did make me laugh...

>> 
>> 
>> Hmmm. I've been accused of being else so often, perhaps it's time to
>> define an 'Abigail number', kind of like an 'Erd\"{o}s number'.
>> 
>>   -  Abigail's Abigail number is 0.
>>   -  Anyone who was once suspected to be the same person as Abigail
>>      has an Abigail number of 1.
>>   -  Your Abigail number is N + 1, if the smallest Abigail number of
>>      the set of people who have been suspected to be the same person
>>      as you is N.
>> 
>> 
>
>Oh dont my head hurts enough as it is ...  Anyhow I think Abigail and
>Abigail are one and the same person thereby making making Abigail's
>Abigail number infinite ...

It's like golf. The lower the number the better.

Woo.. Woo... I'm destioned to always be equal second... Is that good? ;)


-- 
Sam

Just don't create a file called -rf.  :-)
	--Larry Wall


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

Date: Mon, 20 Sep 1999 09:21:10 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: How to create files from CGI script?
Message-Id: <FICpzA.J5@csc.liv.ac.uk>

In article <37E4B362.FE1AFE3C@desertigloo.com>,
"David P. Schwartz" <davids@desertigloo.com> writes:
> Thanks for the suggestion, Bob.  What I forgot to add was that I created
> a subdir beneath the one the scripts are in (inside cgi-bin) and it DOES
> have 666 perms.  Still doesn't work.

Duh Derrrr!

No No No. Never do this put it just about anywhere else but never in or
below cgi-bin. The only things you should ever put their are executables.
Data files should live somewhere away from the URL tree, whtaever it may be.

You may well find you have more luck with permissions then. Failing that
you need to modify your umask from withing the perl script. Be careful
though as it is all to easy to give the outside world permission to do
awful things to you.

I think the perl man pages give you the way to do this somewhere I just
can't remember where. (It may be the camel though)

PS. You need to reformat your posts better, those lines were a bit long.
Also you replied jeopardy style (some will kill file you for that alone)
whatever that is (I am a Brit don't you know) :-)


-- 
Ian J. Garlick
ijg@csc.liv.ac.uk

Experience is that marvelous thing that enables you recognize a mistake
when you make it again.
                -- F. P. Jones



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

Date: Mon, 20 Sep 1999 09:13:40 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: List files in a dir
Message-Id: <37ecfab7.4685322@news.skynet.be>

Abigail wrote:

>I think your solution classifies as a
>trivial, uninteresting one that doesn't work.

And what of systems where "ls" doesn't work? If you dismiss a solution
that doesn't work for some rather exceptional cases, yours certainly
must be dismissed as being too system dependant. `ls` is not perl!

>;;   print <<"END_OF_HTML";
>
>So, where's the <!DOCTYPE ... > ?

True, but irrelevant. You're nitpicking on "valid HTML", and this
doesn't quite belong in this newsgroup. :-) And I mainly want to
generate something that can be used inside a HTML document, not a
complete HTML document, so this header needn't be generated, if the
complete document already contains it.

>;; <HTML>
>;; <HEAD>
>;; <TITLE>Directory Listing of $dir</TITLE>
>
>So.... what if $dir eq '<!-->' ?

I think that the

   foreach($dir,@list) {
       s/([<\"])/$escape{$1}/g;
   }

just above, must have fixed that.


>;;   opendir(DIR, $dir);

>And if the opendir fails?

Then, under -w,

    my @list = sort readdir(DIR);

will generate a warning.


>;; @{[map { qq[<LI><A HREF=\"$_\">$_</A>] } @list ]}
>
>Why the urge to escape "? Does an unescaped " do something weird on
>your system?

Er... They are necessary in:

  print "My list: @{[map { qq[<LI><A HREF=\"$_\">$_</A>] } @list ]}\n";

they just stuck.

>And what are you going to do about the files named: " ", "  ", and "\cC" ?
>If you're going to dis the 'regulars', better come with something that
>indeed really works; there are a lot of allowed characters in filenames
>that are *not* allowed in HTML. And since you're using the files names
>as anchors as well, you should not only care about HTML escaping, but
>about URL escaping as well!

This is the only points for which I agree that they really need fixing.

-- 
	Bart.


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

Date: 20 Sep 1999 09:38:32 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: NDBM_File problem.
Message-Id: <7s4vao$q69$1@lublin.zrz.tu-berlin.de>

Leslie Mikesell <les@Jupiter.mcs.net> wrote in comp.lang.perl.misc:

>Redhat has always made libndbm* a link to libdb* to use the
>Berkeley libraries instead of gdbm which can also emulate ndbm.
>
>RedHat 5.2 used the 1.85 version of the db libraries, 6.0 seems
>to have switched to the file-incompatible 2.x series.  This is
>surprising both for incompatibility problems and licensing issues
>and it seems odd that so few people have noticed.
>
>One way to work around it is to copy the static library and
>matching header file from a 5.2 distribution (follow the symlinks
>to find the real thing) and compile apache (and maybe perl)
>against that.  If you try to switch out the shared libs you will
>probably screw up sendmail and anything else with databases in
>the new format.

An alternative (preferable perhaps) is to get Berkeley DB from
sleepycat and build libdb in compatibility mode.  That keeps
sendmail happy and allows other applications to use the newer
interface.

Anno


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

Date: 20 Sep 1999 11:31:52 +0200
From: Joakim Hove <hove@ido.phys.ntnu.no>
Subject: Re: Newbie questions on list assignment
Message-Id: <k0nbtayx71z.fsf@ido.phys.ntnu.no>

Lishan Song <lishans@evitech.fi> writes:


> @mylist = qw(item1, item2, item3);
> 
> @tmplist = @mylist; #???
> 
> I have following questions on list assignment:
> - Is the assignment legal?
> - If it is legal, are the values copied from @mylist or
>   @tmplist is a reference to @mylist?

What happened when you tried it out :

   #!/path/to/perl -w
   
   @mylist  = qw(item1 item2 item3);
   @tmplist = @mylist; #???
   
   print(" mylist  = @mylist \n");
   print(" tmplist = @tmplist \n\n");
   
   @mylist = qw(NewItem1 NewItem2 NewItem3);
   
   print(" mylist  = @mylist \n");
   print(" tmplist = @tmplist \n");

#################################################################

Produces : 
 mylist  = item1 item2 item3 
 tmplist = item1 item2 item3 

 mylist  = NewItem1 NewItem2 NewItem3 
 tmplist = item1 item2 item3 

So the basic answer is that : 
1. Yes it is legal
2. @tmplist gets a _new_ fresh copy of memory, and is not a reference.

Furthermore you should not use "," to split the items when declaring a
list with qw. Try to run the following little piece :

#!/path/to/perl -w
@mylist = qw(item1,item2,item3);

print("First  item = $mylist[0] \n");
print("Second item = $mylist[0] \n");

By using -w (which you _always_ should do) you get a good hint anyway.

HTH - Joakim


-- 
=== Joakim Hove    www.phys.ntnu.no/~hove/     ======================
# Institutt for fysikk  (735) 93637 / 352 GF  |  Skøyensgate 10D    #
# N - 7034 Trondheim    hove@phys.ntnu.no     |  N - 7030 Trondheim #
=====================================================================


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

Date: 20 Sep 1999 11:34:20 +0200
From: Joakim Hove <hove@ido.phys.ntnu.no>
Subject: Re: Newbie questions on list assignment
Message-Id: <k0naeqix6xv.fsf@ido.phys.ntnu.no>

Joakim Hove <hove@ido.phys.ntnu.no> writes:


> Furthermore you should not use "," to split the items when declaring a
> list with qw. Try to run the following little piece :
> 
> #!/path/to/perl -w
> @mylist = qw(item1,item2,item3);
> 
> print("First  item = $mylist[0] \n");
> print("Second item = $mylist[0] \n");

Sorry, a slip here, substitute the last line with : 
   
  print("Second item = $mylist[1] \n");                

Joakim

-- 
=== Joakim Hove    www.phys.ntnu.no/~hove/     ======================
# Institutt for fysikk  (735) 93637 / 352 GF  |  Skøyensgate 10D    #
# N - 7034 Trondheim    hove@phys.ntnu.no     |  N - 7030 Trondheim #
=====================================================================


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

Date: Mon, 20 Sep 1999 07:21:06 +0000
From: Dean Tran <deantran@ix.netcom.com>
Subject: Novice: network/web solution needed.
Message-Id: <37E5E061.6E2CD72C@ix.netcom.com>



Here  are the questions:

Problem 1:
--------

I try to figure out a way to get  test log files from many machines and
deposit them
in a directory , parse the test log file and post the results
(pass/fail) in the WEB.
All should be automatic without any human intervention in daily basis.

I plan to use perl to parse the data, but what is the easiest way to put

the data in HTML format so user can browse it? What tool/module  do I
need
beside Perl? (CGI, GIMP? etc...)

Hints???

Problem 2:
-------

We have too many machines with extensive amount of network cards, it is
hard to visualize card type (ethernet, fddi, etc...), what is their name
(lan1, lan2),
are they configure ( that has IP address) for any particular machine.

Now, I try to write a perl program to gather all the info (easy part)
and translate
them to a picture where each machine (picture) has certain amount of
network card
(picture) and its associated card type and IP address (text)

What is the tools/ways to solve this problem.

Thanks for all the help

Dean





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

Date: Mon, 20 Sep 1999 10:35:07 +0200
From: "Zarick Berger" <Design@datacomm.ch>
Subject: Printing Hex output
Message-Id: <37e5f521@news.datacomm.ch>

Hello

Could someone tell me how to print out the Hex representation of a string.
Somehow i just cant find it. Sorry...

Its to make shure that the data sent in a socket connection realy is ok.


Thanks a lot for your time

Zarick Berger





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

Date: Mon, 20 Sep 1999 00:28:18 -0700
From: Wise Guy <wiseguy_73NOdjSPAM@go.com>
Subject: Re: Regulat Expressions and Tabulator Problems
Message-Id: <27acf7e8.e1e5574b@usw-ex0106-042.remarq.com>

Hello Michael !

Try something like this :-

# Read all lines into aan array
$File = "a.txt";
open(FILE, "<$File") || die "Cannot open $File\n";
@FileList = <FILE>;
close FILE;

# Compile the whole bunch into one string
$AllTabs = join "\t", @FileList;
# Remove all new line characters
$AllTabs =~ s/\n//g;

# This is your list
@Variables = split "\t", $AllTabs;

Hopefully, this will serve your purpose.
Regards !

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: Mon, 20 Sep 1999 19:15:36 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Regulat Expressions and Tabulator Problems
Message-Id: <MPG.12508a2734a8c512989ce2@news-server>

Michael Scheferhoff writes ..
>I write a text from a file line per line in an array. In every line
>there are 14 "values" seperated by a tabulator. I need to read these
>values and put them into variables. I tried to make a tabualtor machting
>with:
>
>if ($tmp[$x]=~ m/\t/)
>
>but no tab was found.

assuming that @tmp contains the lines of your file (eg. after a C<@tmp = 
<FILEHANDLE>;>) .. there's nothing wrong with the above statement .. if 
it doesn't succeed then there's no "\t" in that line

perhaps they're not actually tabs at all .. perhaps they're some other 
character (maybe locale dependant or some german character set)

try debugging like this

  $tmp[$x] =~ s/[\0-\040\0177]/ '<' . sprintf( '%#o', ord($&)) . '>'/eg;
  print $tmp[$x], "\n";

>Can someone help me with my problem?

if there are "\t"s in there then you should see <011> appear (ASCII for 
"\t") .. if some other character appears then you'll know what to test 
for in your if statement

-- 
 jason - elephant@squirrelgroup.com -


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

Date: Mon, 20 Sep 1999 08:47:46 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: Some e-mails get sent, some don't
Message-Id: <FICoFM.My2@csc.liv.ac.uk>

In article <MPG.124e823cf9a6afcf989756@nntp1.ba.best.com>,
moseley@best.com (Bill Moseley) writes:
> Bart Lateur (bart.lateur@skynet.be) seems to say...
>> Can'ts you quote a command line parameter? Like:
>> 
>> 	$addr =~ s/'/\\'/g;
>> 	if(!open(M,"|mail '$addr'"){
> 
> I wonder that too.  But I also wonder if someone could use LWP and 
> create a POST that includes, say ^U to empty the line buffer.  Is that a 
> possibility?

Me too.

Am I missing something by doing this?

	$addr =~ s/(\W)/\\$1/g; # bit slow and inefficient probably
	If(!open(M,"|mail $addr"){

Eg. for Randals' favourite

	fred&barney@stonehenge.com

would produce

	fred\&barney\@stonhenge\.com

or more importantly for his rm example

	\;\ rm \-rf\ \/     # (untried for obvious reasons :-),
	                    #  '; ls /' is far less dangerous )

I haven't used this yet as I still think I have missed something but every
shell command I have tried it on seems to like it and not complain, and
more importantly passing everything I want too as command line parameters
and not force execution of strange system destroying commands.

I mean I always understood that escaping anything on a command line that
wasn't a special character to the shell would not harm anything as it is
treated the same as it's unsescaped counterpart.

As I say what'd I miss?

-- 
Ian J. Garlick
ijg@csc.liv.ac.uk

Experience is that marvelous thing that enables you recognize a mistake
when you make it again.
                -- F. P. Jones



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

Date: Mon, 20 Sep 1999 09:46:45 +0200
From: "Uli Brass" <uli.brass@netcologne.de>
Subject: System Call only works on 4K of input
Message-Id: <7s4oil$8q2$1@news.netcologne.de>

Hi!

I have got a problem with a system call in my perl script. The script itself
modifies the /etc/mail/virtusertable file and changes the sendmail virtual
users. After the modification I call /usr/sbin/makemap (with sudo as root)
to generate a hash table from the modified source file.  The makmap command
starts to convert the source but stops after exactly 4096 bytes. The rest of
the virtusertable file is completely ignored.
I use the makemap command in the system call exactly the same way as I do it
on the shell. And running it from the shell it converts the whole file into
a hash-table without any problems.

Has anybody got an idea how I can force the system call to take a bigger
buffer for executing the makemap command or something (if this is the
problem) ? Or could it be anything else that causes that behavior?

Thanks very much!

Uli




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

Date: Mon, 20 Sep 1999 08:14:06 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: UNCRAP project proposal
Message-Id: <37e5ec65.1019957@news.skynet.be>

Bart Lateur wrote:

>This is better:
>
>	s/\015\015?\012?|\012/\n/g;

Kick me again. This will match "\015\015" as well. Those unnecessary
optimisations, anyway!

	s/\015\015\012|\015\012|\015|\012/\n/g;

-- 
	Bart.


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

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 853
*************************************


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