[7493] in Perl-Users-Digest
Perl-Users Digest, Issue: 1119 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 3 09:27:15 1997
Date: Fri, 3 Oct 97 06:02:47 -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 Fri, 3 Oct 1997 Volume: 8 Number: 1119
Today's topics:
Re: associative arrays prob thanks <webadmin@prestel.net>
Re: associative arrays prob (Des Herriott)
Re: Can somebody help? (Bart Lateur)
Re: Debuging the CPAN module (Ilya Zakharevich)
DESPERATE for help with string matching (Carol Lynn Smith)
Re: DESPERATE for help with string matching (Ollivier Robert)
help me please! (Vladimir Afanasiev)
https support in libwww <ethan@worldsite.net>
Re: https support in libwww <aas@sn.no>
Re: Newbie: absolute file path's <seay@absyss.fr>
Re: Newbie: absolute file path's <emil.granstrom@era.ericsson.se>
Re: Newbie: absolute file path's (Mark)
Re: Numeric Sort <Alan_Poindexter@bmc.com>
Re: Numeric Sort <seay@absyss.fr>
Re: pattern matching question <ajohnson@gpu.srv.ualberta.ca>
Re: Perl Questions <mrc@pressroom.com>
Re: Q: Working with semaphores <bholzman@mail.earthlink.net>
Re: Read/Write access to a file <bosch@goweb.lu>
Re: Read/Write access to a file (Jason Gloudon)
Re: schwartz story in wired <s..vanechanos@postoffice.worldnet.att.net>
Sorting lists <teetoi@freenet.hut.fi>
Re: Sorting lists (Tom Grydeland)
strange scalar translation in perl cgi wrebel@mindspring.com
System calls <bosch@goweb.lu>
URL Transfer? <gefitch@info-partners.com>
Re: Using Perl Format (Tom Grydeland)
Re: XPUSHi (Ilya Zakharevich)
Re: XPUSHi <aas@sn.no>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 03 Oct 1997 09:55:59 +0100
From: webadmin <webadmin@prestel.net>
Subject: Re: associative arrays prob thanks
Message-Id: <3434B31F.C4D28374@prestel.net>
I figured it out as soon as I had posted it, thanks anyhow
Iqbal
------------------------------
Date: 3 Oct 1997 10:25:33 GMT
From: des@corp.netcom.net.uk (Des Herriott)
Subject: Re: associative arrays prob
Message-Id: <612h6t$3s0$1@taliesin.netcom.net.uk>
In article <Pine.GSO.3.96.971002072824.24335I-100000@usertest.teleport.com>,
Tom Phoenix <rootbeer@teleport.com> writes:
>> for ($x=1; $x<=6; $x++)
>
> The more perlish way is like this.
>
> for $x (1..6) { ... }
Just to go off on a tangent, I use Tom's method when I know the size
of the range I'm using (and it's a small range), but if it's an unknown
quantity, it may be better to use the original method. 1..6 generates
an array of 6 elements, but 1..$n could generate a huge array, which
can be a performance hit.
There's More Than One Way To Do It.
(Yes, I have tested this sort of thing under Benchmark, and the results
do vary depending on $n :-)
--
Des Herriott
des@corp.netcom.net.uk
------------------------------
Date: Fri, 03 Oct 1997 11:16:35 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Can somebody help?
Message-Id: <3437d2b4.9638239@news.tornado.be>
comdog@computerdog.com (brian d foy) wrote:
>>$_ = "c:\q.htm";
>>m/\\/;
>try
>
> print $_, "\n";
>
>and see what that string really contains. remember, avoiding
>double quotes except when you want interpolation saves a lot
>of hassle. :)
Oops. Try this.
$_ = 'c:\q.htm';
print $_, "\n";
and see what that string really contains. ;-)
You need to double the backslashes between single quotes too! The reason
is most likely the possibility to quote a single quote:
$singlequote = '\'';
Bart.
------------------------------
Date: 3 Oct 1997 07:14:04 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Debuging the CPAN module
Message-Id: <6125vs$s8v@agate.berkeley.edu>
In article <3434E969.18BF227E@acay.com.au>,
Dexter Plameras <dexterp@acay.com.au> wrote:
> HELLO
>
> I am tring to Use CPAN that came with Perl5.004_01 to obtain and
> perl: can't resolve symbol 'Perl_safemalloc'
Are you sure that MD5 is compiled with the same perl as one you try to
run it? Apparently they were compiled with different settings...
Ilya
------------------------------
Date: Fri, 03 Oct 1997 07:06:32 GMT
From: carols@sabre.com (Carol Lynn Smith)
Subject: DESPERATE for help with string matching
Message-Id: <34349868.1581990@news.amrcorp.com>
Kinda new at Perl, so forgive me if I ask a simple question:
I have an HTML file with several <table> tags throughout. I need to
match the first occurence of "<table> the stuff in between which can
be just about anything </table>" (this represents the header) ...and
then I need to match the last occurrence of "<table> the stuff in
between which can be just about anything </table>" (this would be the
footer).
Thanks in advance,
DESPERATE
------------------------------
Date: 3 Oct 1997 10:29:21 GMT
From: roberto@eurocontrol.fr (Ollivier Robert)
Subject: Re: DESPERATE for help with string matching
Message-Id: <612he1$9sr$1@polaris.eurocontrol.fr>
[courtesy cc of this posting sent to cited author via email]
In article <34349868.1581990@news.amrcorp.com>,
Carol Lynn Smith <carols@sabre.com> wrote:
> Kinda new at Perl, so forgive me if I ask a simple question:
> I have an HTML file with several <table> tags throughout. I need to
> match the first occurence of "<table> the stuff in between which can
> be just about anything </table>" (this represents the header) ...and
Look into Tom's script called striphtml on CPAN in
"CPAN/authors/id/TOMC/scripts".
--
Ollivier ROBERT -=- Eurocontrol EEC/TS -=- Ollivier.Robert@eurocontrol.fr
Usenet Canal Historique FreeBSD: there are no limits !
------------------------------
Date: Fri, 03 Oct 1997 10:32:09 GMT
From: afan@elnet.msk.ru (Vladimir Afanasiev)
Subject: help me please!
Message-Id: <3434c92b.12252183@news.telekom.ru>
When I run follows program:
>#!/opt/perl/bin/perl -w
>use IO::Socket;
>unless (@ARGV > 1) { die "usage: $0 host document ..." }
>$host = shift(@ARGV);
>$foreach $document ( @ARGV ) {
> $host="www.telekom.ru";
> $document="/";
> $remote = IO::Socket::INET->new( Proto => "tcp",
> PeerAddr => $host,
> PeerPort => "http(80)",
> );
> unless ($remote) { die "cannot connect to http daemon on $host" }
> $remote->autoflush(1);
> print $remote "GET $document HTTP/1.0\n\n";
> while ( <$remote> ) { print }
> close $remote;
>}
>
>exit;
server reply:
>Can't locate IO/Socket.pm in @INC at cgi-bin/tramp.pl line 2.
>BEGIN failed--compilation aborted at cgi-bin/tramp.pl line 2.
Where is error?
---
Vladimir
http://www.ipclub.ru
------------------------------
Date: Thu, 02 Oct 1997 15:29:05 -0800
From: Ethan Joffe <ethan@worldsite.net>
Subject: https support in libwww
Message-Id: <34342E40.6667@worldsite.net>
The newest version of libwww supposedly supports https requests, but it
is not obvious how to get it to make such requests. For instance, doing
a 'GET "https://foo.bar.com"' from the command line returns an
unsupported protocal error.
Anyone know how to get it to do https requests?
How about when using LWP::UserAgent?
Ethan Joffe
Director of Technology
WorlSite Networks
------------------------------
Date: 03 Oct 1997 11:43:49 +0200
From: Gisle Aas <aas@sn.no>
Subject: Re: https support in libwww
Message-Id: <m3g1qjtc4q.fsf@furu.g.aas.no>
Ethan Joffe <ethan@worldsite.net> writes:
> The newest version of libwww supposedly supports https requests, but it
> is not obvious how to get it to make such requests. For instance, doing
> a 'GET "https://foo.bar.com"' from the command line returns an
> unsupported protocal error.
Did you install SSLeay.pm first?
> Anyone know how to get it to do https requests?
>
> How about when using LWP::UserAgent?
You use it just as you would do for plain HTTP.
Regards,
Gisle
------------------------------
Date: Fri, 03 Oct 1997 10:47:38 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Newbie: absolute file path's
Message-Id: <3434B12A.75833B22@absyss.fr>
Emil Granstrom wrote:
>
> Hello.
>
> I am pretty new to Perl and I have stumbled on to a problem.
> I need to expand a relative pathname to a file to an absolute one.
> An example:
> current dir: ~/test
> relative filename: ../IMAGES/myfile.eps
> I need:
> absolute filename /export/users/lzstm1/IMAGES/myfile.eps
>
> Is there a function to expand the relative filename and get the absolute
> one ?
> The only thing I can think of is breaking the relative filename into a
> path and filename, do a 'cd' to the path and print current working dir
> and store that as the absolute path, is there an easier way ?
> I need to do this for a lot of files when parsing an SGML document.
No, not that I know of.
Here is a script that I wrote that does this by breaking the name into
individual parts and looking around for bits and pieces. It does a bit
more than you ask for as it removes symbolic links to. I had a need to
know if two files were the same, but I didn't want to use the inode
number. Maybe you can use it as is, maybe you'll want to water it down
a bit.
It is written as a small package, but if can be launched from the
command line as a stand-alone program too. In this case, the cache
might not be such a good idea.
- doug
--- code starts here ---
#!/usr/local/bin/perl -w
sub real_name { &name_lib::real_name(@_); }
package name_lib;
use strict;
use Carp;
use Cwd;
BEGIN { %name_lib::cache = (); }
unless ( caller )
{
print &real_name(@ARGV), "\n";
exit 0;
}
sub real_name
{
my $name = shift || '.';
croak "cannot find $name\n" unless ( -e $name );
$name .= '/.' if ( -d $name );
$name = "./$name" unless ( substr($name,0,1) eq '/' );
my $startingdir = getcwd();
$name = &search($name);
chdir($startingdir);
croak "ERROR: $name does not exist\n" unless ( -e $name );
$name;
}
sub search
{
my $original = shift || '';
my $name = $original;
return $name_lib::cache{$name} if ( exists $name_lib::cache{$name} );
my $base = $name;
$base =~ s|.*/|/|;
substr($name, -length($base)) = '';
$base = '' if ( $base eq '/.' );
return $base unless ( $name );
chdir($name);
$name = &getcwd();
my $result = &search($name) . $base;
$name_lib::cache{$original} = $result;
$result;
}
1; # just in case it is require'd
------------------------------
Date: Fri, 03 Oct 1997 12:50:45 +0100
From: Emil Granstrom <emil.granstrom@era.ericsson.se>
Subject: Re: Newbie: absolute file path's
Message-Id: <3434DC15.D579FBC3@era.ericsson.se>
Thanks Doug.
I will look through this a use various bits an pieces.
/Emil
Doug Seay wrote:
> Here is a script that I wrote that does this by breaking the name into
> individual parts and looking around for bits and pieces. It does a
[snip]
------------------------------
Date: Fri, 03 Oct 1997 10:40:46 GMT
From: mak@magic.dircon.net (Mark)
Subject: Re: Newbie: absolute file path's
Message-Id: <3434c949.16577332@news.dircon.co.uk>
On Thu, 02 Oct 1997 10:06:37 +0100, Emil Granstrom
<emil.granstrom@era.ericsson.se> wrote:
>Hello.
>
>I am pretty new to Perl and I have stumbled on to a problem.
>I need to expand a relative pathname to a file to an absolute one.
>An example:
> current dir: ~/test
> relative filename: ../IMAGES/myfile.eps
>I need:
> absolute filename /export/users/lzstm1/IMAGES/myfile.eps
>
>Is there a function to expand the relative filename and get the absolute
>one ?
>The only thing I can think of is breaking the relative filename into a
>path and filename, do a 'cd' to the path and print current working dir
>and store that as the absolute path, is there an easier way ?
>I need to do this for a lot of files when parsing an SGML document.
>
>TIA.
>
>Best Regards
> Emil
Hello Emil,
Couple of ways you can do this...if it's only the home dir that you
need expanded, then you could do $ENV{HOME} to find out what the home
dir is. This isn't very portable though, as it would demand that you
be on as that particular user to be able to use the program properly.
A better way to do this would be to use the Cwd.pm module, if you're
using Perl5. Do a search on your systme for this, and will have
details on usage, or check out the perlmod man page.
Mark.
------------------------------
Date: Thu, 02 Oct 1997 16:43:11 -0500
From: "A. Poindexter" <Alan_Poindexter@bmc.com>
To: Chuck <cstewart@flash.net>
Subject: Re: Numeric Sort
Message-Id: <3434156F.C2BF46E@bmc.com>
Chuck wrote:
>
> I have a tab delimited file with name and number. How can I sort this file
> numerically? Thanks......
well, assumming the file is like
file data:
mike 3
tom 2
jane 1
bob 7
tim 4
--
you could
#!/usr/local/bin/perl
open DATA, "data";
$/ = "\n"; #just to be safe
@data = <DATA>;
chop @data;
@dataSorted = sort numsort @data;
$" = "\n";
print "@dataSorted\n";
sub numsort {
my $numA = (split '\t', $a)[1];
my $numB = (split '\t', $b)[1];
return $numA <=> $numB;
}
#you may want to save/restore $" and $/
--
and you'll get:
jane 1
tom 2
mike 3
tim 4
bob 7
hth, good luck!
-
This E-Mail address is NOT-FORSALE or use for JUNK-EMail without the
EXPRESSED WRITTEN PERMISSION of the owner of the above E-Mail Address.
******************************WARNING*********************************
By US Code Title 47, Sec.227(a)(2)(B), a computer/modem/printer
meets the definition of a telephone fax machine. By Sec.227(b)
(1)(C), it is unlawful to send any unsolicited advertisement to
such equipment, punishable by action to recover actual monetary
loss, or $500, whichever is greater, for EACH violation.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Fri, 03 Oct 1997 11:09:40 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Numeric Sort
Message-Id: <3434B654.69928158@absyss.fr>
Chuck wrote:
>
> I have a tab delimited file with name and number. How can I sort this file
> numerically? Thanks......
The perl way would be <fanfare> The Schwartzian Transform </fanfare>.
Yes, another product of Randal's twisted mind. This is basically a
@sortedlist = map {} sort {} map {} @unsortedlist;
expression. The rightmost map produces [$key, $data] pairs, the sort
sorts by $key and the left map takes [$key, $data] pairs and returns the
$data field. I would work something like
my @sorted = map { $_->[1] }
sort { $a->[0] <=> $b->[0] }
map { [ (split(/\t/,$_))[0], $_ ] }
<INPUT_FILE>;
change the [0] if the number doesn't come first, you didn't specify the
input format.
If you've never seen a ST before, don't be frightened. They aren't too
complicated once you get over the size of one. If you are new to Perl,
the punctuation could be a bit hairy too, but if you break it down into
pieces, it should be readable. If you have any questions, please post
'em.
- doug
------------------------------
Date: Fri, 03 Oct 1997 00:08:11 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: pattern matching question
Message-Id: <34348BCB.5634BA1A@gpu.srv.ualberta.ca>
Mike Stok wrote:
!
! In article <3433F6C6.771F@santafe.edu>,
! Timothy H. Keitt <tkeitt@santafe.edu> wrote:
!
! >I'm trying to count the number of matches between a template string
[snip]
! Does
!
! $string = 'a frick aa b aaa banana aaaa fripp';
! $count = 0;
! $count++ while $string =~ /(?=aa)/gc;
!
! do what you want? with 5.004_04 O get $count as 6
I don't think the /gc is necessary in this case just /g...and
another way that works in 5.004 or later (using empty list for
context):
$string = 'a frick aa b aaa banana aaaa fripp';
$count=()=$string=~/(?=aa)/g;
print $count;
I only tried it because someone recently posted this:
()=(1,2);
as parsing but doing nothing --- but it does indeed seem to do
something --- I haven't checked the recent docs to see if this
'context switch' is a documented/intended feature or not, but it
doesn't compile in 5.003 or 5.001.
regards
andrew
------------------------------
Date: 2 Oct 1997 23:33:32 GMT
From: "Matt" <mrc@pressroom.com>
Subject: Re: Perl Questions
Message-Id: <01bccf8b$73f28a50$198345c6@nt1>
Arthur Merar <amerar@unsu.com> wrote in article
<342C998B.670712F3@unsu.com>...
> I have a few questions about Perl:
>
> 1) Is there a way for me to execute a perl/CGI script from an HTML
> document without the user taking any action? Say for example I wanted
> to have a counter on how many times a certain page was hit or something
> like that. How would I execute the perl/CGI script? Can I just call
> it?
I can't even get a perl file to execute when a user wants it to.......maybe
you can help me with that, everytime I hit the submit button, the browser
tries to download the script. The registry is ok, I've checked that
out....
------------------------------
Date: Fri, 03 Oct 1997 00:27:25 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: Joey Mukherjee <joey@swri.edu>
Subject: Re: Q: Working with semaphores
Message-Id: <3434742D.CE96CB8B@mail.earthlink.net>
[posted & mailed]
> I do this process through several iterations. What I thought I might do
> is run A multiple times at once and then do process B once.
>
> I figure the best solution for this a semaphore. I will decrement the
Why not just fork as many children as you want and have them do process
A, and have your parent wait for all of the kids to exit, and then run
process B? If you need much information (like more than an integer) to
flow from the children to the parent, though, things will get more
complicated, fast.
------------------------------
Date: Fri, 03 Oct 1997 01:07:19 +0200
From: Bosch Patrick <bosch@goweb.lu>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Read/Write access to a file
Message-Id: <34342925.32DBE6D1@goweb.lu>
Tom Phoenix wrote:
> That's when you use, for example, @list[$counter] instead of
> $list[$counter], because they're different things. In this case, you
> wanted the latter.
I've done it. Indeed I have made a mistake in my scripts. But ... it didn't
changed anything.
> If you're still having troubles with this, can you cut this down to a
> small script which still shows the problem? If you can make it less than
> about 20 lines, either send it to me or post it to the newsgroup. Good
> luck!
So here it is - and even much smaller than 20 lines:
#!/usr/bin/perl
@list = ("file1.txt", "file2.txt", "file3.txt", "file4.txt");
for ($counter=0; $counter < @list; $counter++) {
open(FILE, "+<". $file[$counter]) || die "Cant open $file[$counter] ";
chop(@file = <FILE>);
for($counter_2=0; $counter_2 < @file; $counter_2++) {
$file[$counter_2] =~ s/1_// } # Changes 1_ to nothing
seek(FILE,0,0);
for($counter_2=0;$counter_2 < @file; $counter_2++) {
print FILE $file[$counter_2], "\n" }
cloes(FILE) }
So what I did: I have created files with different lines (about 10 for each
file) and some of them had a "1_" in there lines. The changes have been made
properly in each of these four files. The files where there was no "1_" patteren
where restored correctly. But the files with "1_" tags had curious lines added
below. I guess that there is a connection with the substitution operator, but I
don't no what kind of connection.
Thank's a lot for your attention
Patrikc
--
Patrick Bosch
+++++++++++++++++++++++++++++++
GoWeb sarl
Internet Project Management
+++++++++++++++++++++++++++++++
Tel.: +352/33 28 01
E-mail: bosch@goweb.lu
14, rue General Patton
L - 7270 Walferdange
Luxembourg
------------------------------
Date: 3 Oct 1997 10:38:46 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: Read/Write access to a file
Message-Id: <612hvm$atf$1@daily.bbnplanet.com>
Bosch Patrick (bosch@goweb.lu) wrote:
: Tom Phoenix wrote:
: where restored correctly. But the files with "1_" tags had curious lines added
: below. I guess that there is a connection with the substitution operator, but
Your problem is that seeking to the beginning of the file does not delete
the file nor does closing the file "shrink" it, so when you overwrite
the file with fewer characters than there were before, it will still
contains characters at the end that corrrespond to the original contents of the
file. Graphically what you are doing looks like this
Take an example with one line: (\n is the end of line character )
1_somestuff\n which becomes somestuff\nf\n
Which looks like two lines
somestuff
f
You really want to write to a temporary file instead instead of destroying
your original file. Or using perl -i even.
Jason Gloudon
------------------------------
Date: Fri, 03 Oct 1997 08:23:53 -0400
From: "Steve Vanechanos, Jr" <s..vanechanos@postoffice.worldnet.att.net>
Subject: Re: schwartz story in wired
Message-Id: <612o9m$mo4@bgtnsc02.worldnet.att.net>
Donald Lingle wrote:
>
> Randall told us at LISA 96 that wired was doing a story on his
> case against Intel. Has anyone heard anything about when/if
> this will be published by Wired.
Not to sure about Wired story but Washington Post did piece around mid
September.
--
Steve Vanechanos CCP/CDP
CEO, DynamicWeb Enterprises, Inc (OTC BB: DWEB)
271 Rt 46 West; Building F
Fairfield NJ 07004
201-244-1000, fax 201-244-1414
stevev@dynamicweb.com
------------------------------
Date: Thu, 02 Oct 1997 20:11:31 +0300
From: Teemu Toivanen <teetoi@freenet.hut.fi>
Subject: Sorting lists
Message-Id: <3433D5C3.C998C79E@freenet.hut.fi>
Hello
I'm using perl 5 and I have a problem how to sort list of lists.
Example:
@test = (
["Nick", "m", "23","misc"],
["John", "m", "20","misc"],
["Maria", "f", "22","misc"],
);
and I need to sort it by the age (3rd of every list)
So that the result would be something like this
@test = (
["Nick", "m", "23","misc"],
["Maria", "f", "22","misc"],
["John", "m", "20","misc"],
);
Thank You...
--
/Teemu Toivanen
/teetoi@iki.fi
***MANWE***
When in danger or doubt, run in circles, scream and shout.
------------------------------
Date: 3 Oct 1997 11:49:06 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: Sorting lists
Message-Id: <slrn639mti.nkr.Tom.Grydeland@mitra.phys.uit.no>
On Thu, 02 Oct 1997 20:11:31 +0300,
Teemu Toivanen <teetoi@freenet.hut.fi> wrote:
> Hello
>
> I'm using perl 5 and I have a problem how to sort list of lists.
> and I need to sort it by the age (3rd of every list)
@sorted = sort {$a->[2] <=> $b->[2]} @unsorted;
(tested)
> Thank You...
You're welcome.
(Explanation: each element of @unsorted is a reference to an array, and
accessing the third element of that is done through the ->[] construct.
If you want secondary sort criteria, take a look at the FMTEYEWTK
article on sorting; http://www.perl.com/CPAN/doc/FMTEYEWTK/sort.html)
> /Teemu Toivanen
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: Fri, 03 Oct 1997 00:11:21 -0600
From: wrebel@mindspring.com
Subject: strange scalar translation in perl cgi
Message-Id: <875855041.11908@dejanews.com>
I'm trying to send a
dynamically
create string in a cgi to
another
cgi via a query_string.
However, the scalar will not
translate its contents when it
is
passed in the query_string;
it
only shows the last segment
of
an array, which created the
scalar.
This probably sounds
convaluted but the code is
below with more information
on
what I'm doing after it.
i.e.,
$sname = "A link description
title.";
@sname = $sname;
($var1, $var2, $var3, $var4,
$var5, $var6, $var7, $var8,
$var9, $var10, $var11,
$var12,
$var13, $var14, $var15,
$var16, $var17, $var18,
$var19, $var20, $var21,
$var22, $var23, $var24,
$var25) = split(/ +/,
$sname[0]);
$count = 0;
while($count <= @sname) {
$count++;
}
$loop = 0;
while ($loop <= $count) {
@string = (0..$loop);
$stuff = "\$var" .
"$string[$loop]" . "\%20";
push (@word, $stuff);
$word = "$word" .
shift(@word);
$loop++;
}
<A
HREF="delete.cgi?$datefile
%2
0$sdate%20$word">Delete
Event</A>
#END OF SCRIPT
. . . . . .
# I'm using a query string to
pass a string through the
scalar
$word.
It prints out as
$var0%20$var1%20$var2%
20
but when passed through
the
query_string only
"$var2%20"
gets through.
Neither of the above is what I
want:
What I want are the scalars
translated into the words
they
contain just as the other two
scalars in the query_string
do,
like this:
A%20link%20description%2
0tit
le
But it won't... why not?
I've tried just using the post
method to accomplish this,
but I
want to use hidden variables
for this and only the
<textarea>
script will pass the full string
through. And that isn't
hidden.
Diane
wrebel@mindspring.com
p.s.
I'm not interested in using
modules for this. : (
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Fri, 03 Oct 1997 01:18:17 +0200
From: Bosch Patrick <bosch@goweb.lu>
Subject: System calls
Message-Id: <34342BB7.40BC979D@goweb.lu>
Hello!
I just wanted to know wich is the excact way to execute system commands within
Perl. I have tried
print '/usr/bin/tar -cvf $file $directory';
But all he did was printing to standard output.
--
Patrick Bosch
+++++++++++++++++++++++++++++++
GoWeb sarl
Internet Project Management
+++++++++++++++++++++++++++++++
Tel.: +352/33 28 01
E-mail: bosch@goweb.lu
14, rue General Patton
L - 7270 Walferdange
Luxembourg
------------------------------
Date: Fri, 03 Oct 1997 07:08:41 -0500
From: Gary Fitch <gefitch@info-partners.com>
Subject: URL Transfer?
Message-Id: <3434E049.1D8A@info-partners.com>
Anyone know how to dynamically force a url transfer via perl code?
Thanks,
Gary
------------------------------
Date: 3 Oct 1997 12:11:52 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: Using Perl Format
Message-Id: <slrn639o88.nkr.Tom.Grydeland@mitra.phys.uit.no>
On Thu, 02 Oct 1997 23:32:16 -0400,
Ignacio Bustamante <IggieBee@worldnet.att.net> wrote:
> Thanks for you rsponse,
Well, it wasn't my followup, but I'll answer anyway:
> I found two examples (as you pointed out), however, I am totally unable
> to exeut them on a scrip. Could you please help me on this?
I tried both of these examples and ran them without trouble. What
happened when you tried to run these examples?
If I have to guess, I think your problems are with the here-document
syntax. Make sure there's no superfluous whitespace (such as
indentation, trailing ^Ms etc on the line with the terminator.
> Example 1:
>
> $str = formline <<'END', 1,2,3;
> @<<< @||| @>>>
> END
This example assumes that you don't indent the line "END".
> Example 2:
>
> use Carp;
> sub swrite {
> croak "usage: swrite PICTURE ARGS" unless @_;
> my $format = shift;
> $^A = "";
> formline($format,@_);
> return $^A;
> }
>
> $string = swrite(<<'END', 1, 2, 3);
> Check me out
> @<<< @||| @>>>
> END
> print $string;
Here it's a bit more visible. The "Here-document" is +outdented; back
to the first coloumn, otherwise it won't work.
> I know, my lack of knowledge on this is "pathetic", but I haven't been
> able to find specific examples for this, on any of the books, and
> manuals I have researched.
Take it easy. You've stumbled upon the intersection of two somewhat
obscure features of Perl, and features authors of books seem to ignore.
Unfortunately, the section on here-documents has been hidden in the
perldata manpage, with no crossrefs from the other quoting mechanisms,
but fortunately there's the entry in perlfaq4 on here-documents
describing the problems people usually run into using them.
You see, we don't want people to stop asking, we just want them to see
if the answers have already been provided for their (and our)
convenience by looking in the FAQs before posting their questions to
USENET.
> TIA,
HTH,
> Ignacio
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: 3 Oct 1997 07:11:05 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: XPUSHi
Message-Id: <6125q9$s7t@agate.berkeley.edu>
In article <m367rfr9cm.fsf@furu.g.aas.no>, Gisle Aas <aas@sn.no> wrote:
> I can't get XPUSHi (or PUSHi/PUSHn) to work in the PPCODE section of
> an XSUB. The compiler gives the following error message:
>
> Foo.xs: In function `XS_Foo_foo':
> Foo.xs:17: `targ' undeclared (first use this function)
> Foo.xs:17: (Each undeclared identifier is reported only once
> Foo.xs:17: for each function it appears in.)
>
> All the examples I have found use XPUSHs(sv_2mortal(newSViv(int)))
> instead, so is XPUSHi supposed to work? I even tried adding dTARG to
> the code but that only gave me a core dump. I am using perl5.004.
>
> void
> foo()
> PPCODE:
> XPUSHi(42); /* gives `targ' undeclared */
> XPUSHs(sv_2mortal( newSViv(42))); /* ok */
Do not. Theoretically OP_ENTERSUB nodes have a target, but I would
not like to use it from an XSUBs. Especially taking into account that
target is one and only one, but you may want to put several integer
values on stack. Did you read the section on targets in guts?
Hope this helps,
Ilya
------------------------------
Date: 03 Oct 1997 11:49:32 +0200
From: Gisle Aas <aas@sn.no>
Subject: Re: XPUSHi
Message-Id: <m3en63tbv7.fsf@furu.g.aas.no>
ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
> In article <m367rfr9cm.fsf@furu.g.aas.no>, Gisle Aas <aas@sn.no> wrote:
> > I can't get XPUSHi (or PUSHi/PUSHn) to work in the PPCODE section of
> > an XSUB. The compiler gives the following error message:
> >
> > Foo.xs: In function `XS_Foo_foo':
> > Foo.xs:17: `targ' undeclared (first use this function)
> > Foo.xs:17: (Each undeclared identifier is reported only once
> > Foo.xs:17: for each function it appears in.)
> >
> > All the examples I have found use XPUSHs(sv_2mortal(newSViv(int)))
> > instead, so is XPUSHi supposed to work? I even tried adding dTARG to
> > the code but that only gave me a core dump. I am using perl5.004.
> >
> > void
> > foo()
> > PPCODE:
> > XPUSHi(42); /* gives `targ' undeclared */
> > XPUSHs(sv_2mortal( newSViv(42))); /* ok */
>
> Do not. Theoretically OP_ENTERSUB nodes have a target, but I would
> not like to use it from an XSUBs. Especially taking into account that
> target is one and only one, but you may want to put several integer
> values on stack. Did you read the section on targets in guts?
Obviously not. I think the section in perlguts called "XSUBs and the
Argument Stack" need a revision to reflect that X?PUSHs is quite
different from X?PUSH[pniu]. Currently this section says:
| Now that there is room on the stack, values can be pushed
| on it using the macros to push IVs, doubles, strings, and
| SV pointers respectively:
|
| PUSHi(IV)
| PUSHn(double)
| PUSHp(char*, I32)
| PUSHs(SV*)
The same goes for the API listing. I do not understand this enough
to propose a change myself.
> Hope this helps,
Yes, thank you!
Regards,
Gisle
------------------------------
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 1119
**************************************