[11016] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4616 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 11 06:17:15 1999

Date: Mon, 11 Jan 99 03:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 11 Jan 1999     Volume: 8 Number: 4616

Today's topics:
    Re: BUG: getpwnam()? - Perl shipped with RedHat5.2 <eugene@snailgem.org>
    Re: BUG: getpwnam()? - Perl shipped with RedHat5.2 <uri@home.sysarch.com>
        C code to interpret Perl scripts? (Adrian Price)
    Re: Can I execute Perl Scipt from VB ? <bsumpter@msn.com.au>
    Re: Can I execute Perl Scipt from VB ? <bsumpter@msn.com.au>
    Re: Can I execute Perl Scipt from VB ? (Bart Lateur)
        Help Wanted <bob@tokensystems.com>
        how to greb whole words only? (Jason Q.)
        internal error: glob failed (Danny Aldham)
    Re: Invoking an unattended infinite loop <partha@mihy.mot.com>
    Re: Matching binary strings <Tim.Shaw@alcatel.be>
    Re: Newbie: Recursive data structure with recursive sub (Ronald J Kimball)
        Optimizing `eval' in a loop <hniksic@srce.hr>
    Re: Optimizing `eval' in a loop (Sean McAfee)
    Re: Optimizing `eval' in a loop <uri@home.sysarch.com>
    Re: Optimizing `eval' in a loop (Ilya Zakharevich)
    Re: Optimizing `eval' in a loop (Ilya Zakharevich)
    Re: Optimizing `eval' in a loop (Sean McAfee)
        password <peter.herger@swisslife.ch>
    Re: Perl Criticism topmind@technologist.com
        Printing the return value from a subroutine? <jens.johanneson@edicom.se>
    Re: Printing the return value from a subroutine? <ajohnson@gatewest.net>
        referer address grey.cloud@usa.net
    Re: referer address <aidan@salvador.blackstar.co.uk>
        rounding <tom@vitesse.com>
    Re: rounding dave@mag-sol.com
    Re: rounding (Bart Lateur)
        Specifying Location in Perl <Tojo.Punnoose@Blr.Sni.de>
    Re: Uploading PC files works - but not Mac files <henrik@byggeinfo.dk>
    Re: Using PerlScript with MS Personal Web Server (ASP) <matthew.sergeant@eml.ericsson.se>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sun, 10 Jan 1999 19:44:26 -0500
From: Eugene Sotirescu <eugene@snailgem.org>
To: DumbKid <dumbkid@ix.netcom.com>
Subject: Re: BUG: getpwnam()? - Perl shipped with RedHat5.2
Message-Id: <3699496A.7283B99D@snailgem.org>

What do you mean, you have no way? What's the output you get?

Your Perl script works fine on my machine (RH 5.2 Intel).

You might try a more elaborate version, including the -w flag:

#!/usr/bin/perl -w


  if (@pwent = getpwnam("snailgem")){
    print "pwent is @pwent \n";
  }
  else { die "no such user\n";}

outputs:
snailgem EBiI5PjvSvhAM 503 504    /home/snailgem /bin/bash


DumbKid wrote:

> Hi all,
>
> I have install RedHat5.2 in both Intel and Alpha machines.
> I have no way to get the "realname" of the users in /etc/passwd
> file using Perl5.005m4-1
>
> However, using standard C can get the realname no problem. Is it
> just me or there is a bug in perl package w/ redhat5.2
>
> PERL
> ====
>
>   #!/usr/bin/perl
>
>   my(@pwent) = getpwnam("username");
>   print "@pwent \n";
>
> Standard C
> ==========
>
>   #include <stdio.h>
>   #include <pwh.h>
>   #include <sys/types.h>
>
>   main()
>   {
>      struct passwd *pwent;
>      pwent = getpwnam("username");
>      printf("realname = (%s) \n", pwent->pw_gecos);
>   }
>
> Any idea?? Both Intel and Alpha distributions have this problem.
>
> Regards,
> Tom



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

Date: 11 Jan 1999 00:59:53 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: BUG: getpwnam()? - Perl shipped with RedHat5.2
Message-Id: <x7n23qic2u.fsf@home.sysarch.com>

>>>>> "ES" == Eugene Sotirescu <eugene@snailgem.org> writes:

  ES>   if (@pwent = getpwnam("snailgem")){
  ES>     print "pwent is @pwent \n";
  ES>   }
  ES>   else { die "no such user\n";}

  ES> outputs:
  ES> snailgem ************* 503 504    /home/snailgem /bin/bash
               ^^^^^^^^^^^^^
                     ^
encrypted password deleted

i am sure the poster appreciated your help but you shouldn't have posted
the encrypted password in your example. now it could be cracked (and des
is very crackable these days). i recommend you change that password ASAP.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Sun, 10 Jan 1999 22:58:04 -0800
From: adrian@sequoiarecords.com (Adrian Price)
Subject: C code to interpret Perl scripts?
Message-Id: <adrian-1001992258040001@webgalaxy.com>

I am working on a MUD, and I am looking for C code I can use to script
parts of it using perl scripts, all as text files. Is this code
commonly/freely available? How much does it cost?

-- 
---
http://www.sequoiarecords.com/
Web Designer/Coder at Large


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

Date: Mon, 11 Jan 1999 17:04:10 +1100
From: "Barry G. Sumpter" <bsumpter@msn.com.au>
Subject: Re: Can I execute Perl Scipt from VB ?
Message-Id: <77c43a$shl$1@m2.c2.telstra-mm.net.au>

Feel free to identify the system command your refering to.

baz
dave@mag-sol.com wrote in message <7755r5$457$1@nnrp1.dejanews.com>...
>In article <774gia$p49$1@m2.c2.telstra-mm.net.au>,
>  "Barry G. Sumpter" <bsumpter@msn.com.au> wrote:
>> This is a multi-part message in MIME format.
>
>Plaase don't do that. Usenet is a *text* medium.
>
>> Colleagues,
>>
>> I'm currently working with two very intelligent ClearCase experts.
>> They both swear by perl and have developed extensive custom automation =
>> perl script for ClearCase.
>>
>> However, 90% of our development work is in VB and a lot of supporting =
>> apps are in exchange/outlook forms using VBScript and VBA.  The other =
>> 10% being C++.
>>
>> We would love to be able to execute Perl scripts using VB / VBScript / =
>> VBA / C++.
>>
>> Does anyone know of an activex control either a .dll or .exe or .ocx =
>> that would
>> allow us to do this?
>
>I've not used VB since I saw the light many years ago, but I'd be very
>surprised if it didn't support some kind of 'system' command to run
external
>programs. What's to stop you using that to call your Perl scrits?
>
>--
>Dave Cross
>Magnum Solutions Ltd: <http://www.mag-sol.com/>
>London Perl M[ou]ngers: <http://london.pm.org/>
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own




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

Date: Mon, 11 Jan 1999 17:23:39 +1100
From: "Barry G. Sumpter" <bsumpter@msn.com.au>
Subject: Re: Can I execute Perl Scipt from VB ?
Message-Id: <77c57q$1qq$1@m2.c2.telstra-mm.net.au>

Yeah, Been there done that.
It only works with IE not vb or outlook.
But thanks anyway.


Baz



Eric Bohlman wrote in message ...
>Barry G. Sumpter <bsumpter@msn.com.au> wrote:
>: This is a multi-part message in MIME format.
>
>Please post single-part messages in text format.
>: We would love to be able to execute Perl scripts using VB / VBScript / =
>: VBA / C++.
>
>: Does anyone know of an activex control either a .dll or .exe or .ocx =
>: that would
>: allow us to do this?
>
>I think ActiveState's PerlScript is what you want: it provides an ActiveX
>scripting interface to perl.  It comes free with ActiveState's
>implementation of Perl.
>




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

Date: Mon, 11 Jan 1999 08:03:42 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Can I execute Perl Scipt from VB ?
Message-Id: <369db020.2522265@news.skynet.be>

Barry G. Sumpter wrote:

>Feel free to identify the system command your refering to.

>>I've not used VB since I saw the light many years ago, but I'd be very
>>surprised if it didn't support some kind of 'system' command to run
>>external programs. What's to stop you using that to call your Perl
>>scrits?

VB's "Shell" (programs only) or the ShellExecute API call.

	Bart.


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

Date: Mon, 11 Jan 1999 02:08:10 -0800
From: "bob@tokensystems.com" <bob@tokensystems.com>
Subject: Help Wanted
Message-Id: <3699CD8A.25AEB33B@tokensystems.com>

Perl Programmer Wanted
Very experienced in Perl and Linux Red Hat. Must be able to create
anything we need in Perl, and must be able to adapt to a tremendous
amount of currently existing code. Sys. Admin skills a big plus. Work at

home, full time+
Write bob@tokensystems.com



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

Date: Mon, 11 Jan 1999 09:46:22 GMT
From: pigs_can_fly@mindless.com (Jason Q.)
Subject: how to greb whole words only?
Message-Id: <369bc586.25032544@news.cyberway.com.sg>

Currently, now I'm using:

@results = grep(/"God"/,@database);

but it greps every word containing "God", including Godffrey, Goddamn
etc...


How do I grep whole words only?	

Any help would be appreciated.

Thank you.


Jason Q.


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

Date: 10 Jan 1999 21:29:44 -0800
From: danny@hendrix.postino.com (Danny Aldham)
Subject: internal error: glob failed
Message-Id: <77c288$64q$1@hendrix.postino.com>

X-Newsreader: TIN [version 1.2 PL2]

Below is a very stripped down version of some code I was running that fails
with an internal error: glob failed at line 7, <_GEN_0> chunk2.

#!/usr/local/bin/perl -w
@article= "Newsgroups: comp.os.linux.misc
Path: news.campus.mci.net ";
&feed ("") ;
sub  feed () {
     while(<@article>) {
     }
}


In the production code , @article was a news article that had been pulled
in, and was going to be worked on. The worrisome problem is that the error
was kicking to a shell that began executing the @article lines.
This is on perl5.005_02 on RH5.2 linux. 

--
Danny Aldham             SCO Ace, MCSE, JAPH, DAD 
Field Service Manager    BCTel Systems Support
7000 Lougheed Hwy, Burnaby BC   (604) 444-8949


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

Date: Tue, 12 Jan 1999 13:27:26 +0530
From: Ramanujam Parthasarathi <partha@mihy.mot.com>
To: Jim Rhodes <jim@nospam.deadlock.com>
Subject: Re: Invoking an unattended infinite loop
Message-Id: <369B0065.C660A126@mihy.mot.com>

I don't get exactly what you are trying to do. I have a suggestion - try
running the job in the background - with an '&'.

HTH
Partha

Jim Rhodes wrote:

> I have a script with a while () loop (see below) but I'm
> having trouble getting it to run continually by itself.





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

Date: Mon, 11 Jan 1999 08:50:28 +0100
From: Tim Shaw <Tim.Shaw@alcatel.be>
Subject: Re: Matching binary strings
Message-Id: <3699AD44.BF9E6C45@alcatel.be>

Tad McClellan wrote:

> Tim Shaw (Tim.Shaw@alcatel.be) wrote:
> : In the following example, the strings are not in fact binary, but they
> : would be at another level of interpolation (if that's the correct
> : expression). Any idea why they do not match?
> [ ...]

> : my $value =  "\\x01\\x02";
> : my $mask = "\\x01\\x02";
>
> : if ($value =~ m/$mask/)
>                   ^^^^^
>
>    But that is "double quotish", so the hex escapes get converted,
>    and you are attempting to match 2 bytes (which don't match the
>    ASCII codes for any of the printable chars in $value)

I'm trying to find a way of avoiding the "double quotish" behaviour of the
match operation, if possible.


>    It will match if you:
>
>       my $value =  "\x01\x02";   # interpolate to 2 bytes

This is true, but it's not what I want to achieve. I want to match the 8
byte string, not the 2 byte string.

Tim




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

Date: Sun, 10 Jan 1999 23:20:24 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Newbie: Recursive data structure with recursive subroutine.
Message-Id: <1dlfv4t.o0c4ov6qw1emN@bay2-317.quincy.ziplink.net>

<root@gate.gate.net> wrote:

> $TopLevelArray[$indexnum] = createsub ();
> 
> sub createsub 
> {
>   my (%localhash,$localindexnum);
>   while (<INPUTFILE>) { #continue reading through text file
>     do something to fill in %localhash;
>     if (certain conditions) {
>       $localhash{$TopLevelArray[$localindexnum]} = createsub ();
>     }
>     return %localhash;
>   }
> }

You call the sub in a scalar context, but return the contents of a hash.
This does not make sense.

Have you tried returning a reference to the hash instead?

   return \%localhash;

Note that the fact that %localhash is a lexical [my()] variable is
important here.  If it were a global, you would be returning a reference
to the same hash each time, instead of a separate hash for each
invocation.


You may need to read the Perl documentation on references and nested
data structures.

perlref
perllol
perldsc

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 11 Jan 1999 05:13:23 +0100
From: Hrvoje Niksic <hniksic@srce.hr>
Subject: Optimizing `eval' in a loop
Message-Id: <kighfty5twc.fsf@jagor.srce.hr>

I have a loop that looks like this:

foreach (...) {
  eval ($expr);   # Evaluate some user-specified code
  ... some code that doesn't change $expr here ...
}

Now, $expr is obtained at run-time (not compile-time), but it is
expected to remain unchanged through the entire foreach loop.  Will
Perl recompile $expr in every pass of the loop?

If so, is it possible to inform Perl that $expr is unchanged through
the loop, and that it is safe to compile the expression only once?
This would be analogous to the /o modifier in regexps.


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

Date: Mon, 11 Jan 1999 05:51:15 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Optimizing `eval' in a loop
Message-Id: <njgm2.1411$Ge3.7597187@news.itd.umich.edu>

In article <kighfty5twc.fsf@jagor.srce.hr>,
Hrvoje Niksic  <hniksic@srce.hr> wrote:
>I have a loop that looks like this:

>foreach (...) {
>  eval ($expr);   # Evaluate some user-specified code
>  ... some code that doesn't change $expr here ...
>}

>Now, $expr is obtained at run-time (not compile-time), but it is
>expected to remain unchanged through the entire foreach loop.  Will
>Perl recompile $expr in every pass of the loop?

I'm almost certain that it will.

>If so, is it possible to inform Perl that $expr is unchanged through
>the loop, and that it is safe to compile the expression only once?
>This would be analogous to the /o modifier in regexps.

Compile the expression just once, before the loop begins:

$mysub = eval "sub { $expr }";
foreach (...) {
	&$mysub;
	# rest of loop code
}

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: 11 Jan 1999 00:56:31 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: Optimizing `eval' in a loop
Message-Id: <x7pv8mic8g.fsf@home.sysarch.com>

>>>>> "Hrvoje" == Hrvoje Niksic <hniksic@srce.hr> writes:

  Hrvoje> I have a loop that looks like this:
  Hrvoje> foreach (...) {
  Hrvoje>   eval ($expr);   # Evaluate some user-specified code
  Hrvoje>   ... some code that doesn't change $expr here ...
  Hrvoje> }

  Hrvoje> Now, $expr is obtained at run-time (not compile-time), but it is
  Hrvoje> expected to remain unchanged through the entire foreach loop.  Will
  Hrvoje> Perl recompile $expr in every pass of the loop?

  Hrvoje> If so, is it possible to inform Perl that $expr is unchanged through
  Hrvoje> the loop, and that it is safe to compile the expression only once?
  Hrvoje> This would be analogous to the /o modifier in regexps.

if you make $expr a sub definition it would do what you want. make the
text for an anonymous sub with the expression you are passed and a
proper api for the loop code. eval that text which will return a sub
ref. save that in a variable and call it in the loop with its arguments.

this can go further by making a closure but that is beyond your
immediate question.

hth,

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: 11 Jan 1999 05:57:13 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Optimizing `eval' in a loop
Message-Id: <77c3rp$chg$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was NOT sent to Hrvoje Niksic 
<hniksic@srce.hr>],
who wrote in article <kighfty5twc.fsf@jagor.srce.hr>:
> I have a loop that looks like this:
> 
> foreach (...) {
>   eval ($expr);   # Evaluate some user-specified code
>   ... some code that doesn't change $expr here ...
> }
> 
> Now, $expr is obtained at run-time (not compile-time), but it is
> expected to remain unchanged through the entire foreach loop.  Will
> Perl recompile $expr in every pass of the loop?

Yes.  It might be possible to cache the eval()ed value inside the Perl
value for $expr, except for the problem of recognition when the
"context" remain the same.  Given your experience with Lisp, you might
have some insight how to circumvent this.

> If so, is it possible to inform Perl that $expr is unchanged through
> the loop, and that it is safe to compile the expression only once?
> This would be analogous to the /o modifier in regexps.

Just put the whole loop *inside* eval.

Ilya


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

Date: 11 Jan 1999 05:58:15 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Optimizing `eval' in a loop
Message-Id: <77c3tn$chp$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Sean McAfee
<mcafee@waits.facilities.med.umich.edu>],
who wrote in article <njgm2.1411$Ge3.7597187@news.itd.umich.edu>:
> >If so, is it possible to inform Perl that $expr is unchanged through
> >the loop, and that it is safe to compile the expression only once?
> >This would be analogous to the /o modifier in regexps.
> 
> Compile the expression just once, before the loop begins:
> 
> $mysub = eval "sub { $expr }";
> foreach (...) {
> 	&$mysub;
> 	# rest of loop code
> }

You forget about the giant overhead of subroutine call.

Ilya


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

Date: Mon, 11 Jan 1999 06:12:42 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Optimizing `eval' in a loop
Message-Id: <uDgm2.1417$Ge3.7607260@news.itd.umich.edu>

In article <77c3tn$chp$1@mathserv.mps.ohio-state.edu>,
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>[A complimentary Cc of this posting was sent to Sean McAfee
><mcafee@waits.facilities.med.umich.edu>],
>who wrote in article <njgm2.1411$Ge3.7597187@news.itd.umich.edu>:
>> Compile the expression just once, before the loop begins:

>> $mysub = eval "sub { $expr }";
>> foreach (...) {
>> 	&$mysub;
>> 	# rest of loop code
>> }

>You forget about the giant overhead of subroutine call.

I suppose I just assumed an eightfold speed increase was sufficient as a
starting point for optimization:

use Benchmark;

timethese 5_000, {
	every_time => sub { for (0..20) { eval '$n++' } },
	once       => sub { $a = eval 'sub { $n++ }'; for (0..20) { &$a } }
};

Benchmark: timing 5000 iterations of every_time, once...
every_time: 16 wallclock secs (16.31 usr +  0.00 sys = 16.31 CPU)
      once:  2 wallclock secs ( 2.03 usr +  0.00 sys =  2.03 CPU)

I ran this benchmark before posting my original article, but didn't include
it as I considered it obvious that compile-once would handily beat
compile-many.  I wasn't trying to do an exhaustive analysis.

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: Mon, 11 Jan 1999 08:53:34 +0000
From: Herger Peter <peter.herger@swisslife.ch>
Subject: password
Message-Id: <3699BC0E.6844F7AE@swisslife.ch>

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi all
<br>Does anyone have an idea, how I can store all my passwords in a seperate
File? I've wrote a perl script to connect to a router and get some files
with ftp, but I don't wan't to write the passwords in this perlscript.
I'd like to have all passwords in one file. Is this possible to do so??
<p>Thanks
<p>-Peter Herger</html>



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

Date: Mon, 11 Jan 1999 06:03:50 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <77c486$ri0$1@nnrp1.dejanews.com>

(2nd reply)

>> or just table him. he likes to go to extremes. table oriented
programming sounds like a real loser. imagine a relational database and
rows storing code. or programming in excel in the large!
nightmares on nightmares! <<

Hey! What is wrong with storing code in tables?
Just because it is a new idea (to you) does not mean it is bad.
What's the matter, you cannot handle new ideas?

I suppose you believe that code in tables cannot be
checked for syntax. This is not true. Who says that
only code in flat files can be checked.

You seem afraid to stretch your mind. Try thinking
before ridiculing. Did your ancestors ridicule Columbus
and Galileo?

I did not see any specific criticism. Very typical of your kind.

-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 11 Jan 1999 08:51:35 +0100
From: Jens Johanneson <jens.johanneson@edicom.se>
Subject: Printing the return value from a subroutine?
Message-Id: <3699AD87.2050BAC5@edicom.se>

Is there a way for me to print this four lines example code in only two
lines?

$tmp = &myFunc();
print "This is the first return value of myFunc =$tmp";
$tmp = &myFunc();
print "This is the second return value of myFunc =$tmp";


I've tried thing like
print "This is the first return value of myFunc =&myFunc()";
print "This is the second return value of myFunc =&myFunc()";
but it won't work...



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

Date: Mon, 11 Jan 1999 03:13:13 -0600
From: Andrew Johnson <ajohnson@gatewest.net>
Subject: Re: Printing the return value from a subroutine?
Message-Id: <3699C0A9.30B7C468@gatewest.net>

Jens Johanneson wrote:
!
! Is there a way for me to print this four lines example code in only
! two lines?
! 
! $tmp = &myFunc();
! print "This is the first return value of myFunc =$tmp";
! $tmp = &myFunc();
! print "This is the second return value of myFunc =$tmp";
 
how about just:

print "This is the first return value of myFunc =", &myFunc();
print "This is the first return value of myFunc =", &myFunc();

or if myFunc() is context sensitive and you want scalar context:

print "This is the first return value of myFunc =", scalar &myFunc();
print "This is the first return value of myFunc =", scalar &myFunc();
 
! I've tried thing like
! print "This is the first return value of myFunc =&myFunc()";
! print "This is the second return value of myFunc =&myFunc()";
! but it won't work...

you have to do extra work to interpolate a function within a
double quoted string, the FAQ has information on this ... see
perlfaq4:

perlfaq4.pod:=head2 How do I expand function calls in a string?

for further information.

regards
andrew


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

Date: Mon, 11 Jan 1999 10:27:45 GMT
From: grey.cloud@usa.net
Subject: referer address
Message-Id: <77cjmv$8mb$1@nnrp1.dejanews.com>

Sorry for lame question...
Please be so kind as to explain how can I get an URL of the user visited my
page in cgi during the session?
Thanx.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 11 Jan 1999 10:41:29 GMT
From: Aidan Rogers <aidan@salvador.blackstar.co.uk>
Subject: Re: referer address
Message-Id: <77ckgp$2c7$1@nclient3-gui.server.ntli.net>

grey.cloud@usa.net wrote:
> Sorry for lame question...
> Please be so kind as to explain how can I get an URL of the user visited my
> page in cgi during the session?

$ENV{'HTTP_REFERER'} holds that value.

Aidan


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

Date: Sun, 10 Jan 1999 22:37:46 -0800
From: Tom Cruce <tom@vitesse.com>
Subject: rounding
Message-Id: <36999C3A.D9DCF4F9@vitesse.com>

Whats the best way to to round a floating point scalar into an integer ?
I've looked around for a function
to do this, but I can't seem to find one. Any ideas ?




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

Date: Mon, 11 Jan 1999 09:46:55 GMT
From: dave@mag-sol.com
Subject: Re: rounding
Message-Id: <77chae$6rc$1@nnrp1.dejanews.com>

In article <36999C3A.D9DCF4F9@vitesse.com>,
  Tom Cruce <tom@vitesse.com> wrote:
> Whats the best way to to round a floating point scalar into an integer ?
> I've looked around for a function
> to do this, but I can't seem to find one. Any ideas ?

Have you seen the 'int' function? I realise that this doesn't round, it just
truncates but used in conjunction with with elementary maths principles you
can use it to round.

Dave...

--
Dave Cross
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 11 Jan 1999 10:24:03 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: rounding
Message-Id: <369ad08c.10801605@news.skynet.be>

Tom Cruce wrote:

>Whats the best way to to round a floating point scalar into an integer ?
>I've looked around for a function
>to do this, but I can't seem to find one. Any ideas ?

sprintf

	$number = 8.99;
	$integer = sprintf('%d',$number);
	print "number = $number, integer = $integer\n";

Result:

	number = 8.99, integer = 8

Oh dear.

	Bart.


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

Date: Mon, 11 Jan 1999 11:37:43 +0530
From: Tojo Punnoose <Tojo.Punnoose@Blr.Sni.de>
Subject: Specifying Location in Perl
Message-Id: <3699952F.60FF4FBE@Blr.Sni.de>

Hi,

    I've a html page, which allows people to download a zip file, after
putting in their details in the form provided in the same page. When
they click on the submit button, the perl script verifies the data they
entered and specify the location as

print "Location: http://mydomain.com/download/file.zip\n\n";

So it will download the file. Now I want the browser to be redirected to

another html page, once it starts downloading. . Is it possible to
specify 2 Location in the perl script?? Or is there any other way...

Please help.
Thanks in advance
Tojo.





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

Date: Mon, 11 Jan 1999 09:03:30 +0100
From: Henrik Hansen <henrik@byggeinfo.dk>
Subject: Re: Uploading PC files works - but not Mac files
Message-Id: <3699B052.4C0D8C86@byggeinfo.dk>

Sorry for the late reply....
I have tried uploading GIF and JPG and they are not corrupted. As John
Moreno said in his reply GIF and JPG do not maintain any information in the
resource fork. But when I uploaded a simple text file or a CAD file they
didn't work. If the user compress the files using ex. SIT (a MAC "version"
of ZIP) the uncompressed files is OK.
Be sure to investigate the two browsers NS4 and IE4 they seem to behave
differently regarding uploading (the byte size of files).

If I find out more I will let you know.

Henrik Hansen

"Charles R. Thompson" wrote:

> >I'm working on a project were we uploads files using a browser.
> >I have made a perl program which receives the files from the html form.
> >All
> >this works perfect when dealing with PC files, but when uploading Mac
> >files
> >the Resource Fork part is missing (a Mac file consist of a Resource
> Fork
> >and a Data Fork).
>
> I have no answer for you, but would like to ask something as I am doing
> something similar. Does this apply to ALL Mac files? For my script, they
> are only doing JPG and GIF uploads. I will eventually b e allowing
> multiple file formats, so this is probably (already) going to become an
> issue. About 75% of the people using my uploading script will be MAC
> based, so you have me freeeeekin out now.
>
> CT



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

Date: Mon, 11 Jan 1999 10:10:44 +0000
From: Matt Sergeant <matthew.sergeant@eml.ericsson.se>
Subject: Re: Using PerlScript with MS Personal Web Server (ASP)
Message-Id: <3699CE24.CA37C61@eml.ericsson.se>

Praveen wrote:
> 
> Tryin to use PerlScript in ASP pages on personal web server. NT
> workstation4.0.

> $Response->writeblock(0); $Response = $main::Response; error '80004005'
> 
> Can't call method "writeblock" on an undefined value.

The installation didn't work correctly. Try it again. Make sure you are
Administrator.

-- 
<Matt email="matt@teamamiga.org" />

| Fastnet Software Ltd              |   Perl in Active Server Pages   |
| Perl Consultancy, Web Development |   Database Design   |    XML    |
| http://come.to/fastnet            |    Information Consolidation    |


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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