[22429] in Perl-Users-Digest
Perl-Users Digest, Issue: 4650 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 2 11:05:39 2003
Date: Sun, 2 Mar 2003 08:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 2 Mar 2003 Volume: 10 Number: 4650
Today's topics:
Re: $SIG{__DIE__} and modules <webmaster@neverseenbefore.com>
Re: FAQ proposal: Why can't I compare two strings using <abigail@abigail.nl>
Re: Feedback request: photobrowser <ubl@schaffhausen.de>
Re: filename returned by server? (Tad McClellan)
Re: filename returned by server? <newsfeed2@boog.co.uk>
Going around in circles with modules? <newsfeed2@boog.co.uk>
Re: Going around in circles with modules? <newsfeed2@boog.co.uk>
Re: grep command in a perl script <barryk2@SPAM-KILLER.mts.net>
how to read form output in perl procedure <qqhnieuwen.1@hccnet.nl>
Re: how to read form output in perl procedure <newsfeed2@boog.co.uk>
Re: Killing "process groups" on Win32 <allan_herriman.hates.spam@agilent.com>
Looking for a utility to remove duplicates <2001_jade@msn.com>
Re: Looking for a utility to remove duplicates <newsfeed2@boog.co.uk>
Re: Looking for a utility to remove duplicates <2001_jade@msn.com>
Re: Looking for a utility to remove duplicates <newsfeed2@boog.co.uk>
Re: Looking for a utility to remove duplicates <2001_jade@msn.com>
Re: Looking for a utility to remove duplicates <newsfeed2@boog.co.uk>
Re: moving a string 'string' into perl script <noreply@gunnar.cc>
Re: moving a string 'string' into perl script <tassilo.parseval@post.rwth-aachen.de>
Re: moving a string 'string' into perl script <usenet@tinita.de>
Re: my own "modules" for want of a better name <newsfeed2@boog.co.uk>
Re: my own "modules" for want of a better name (Tad McClellan)
Re: my own "modules" for want of a better name <newsfeed2@boog.co.uk>
Re: recursively adding arrays of arrays <abigail@abigail.nl>
Re: search algorithm needed (FMAS)
Re: string manipulations (david)
Re: The perl CD bookshelf <hvtijen@hotwail.com>
Re: The perl CD bookshelf <newsfeed2@boog.co.uk>
Re: The perl CD bookshelf <newsfeed2@boog.co.uk>
Re: The perl CD bookshelf <jurgenex@hotmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 2 Mar 2003 14:41:08 +0100
From: "Dieter D'Hoker" <webmaster@neverseenbefore.com>
Subject: Re: $SIG{__DIE__} and modules
Message-Id: <b3t1ku$ujkvu$1@ID-155251.news.dfncis.de>
"Brian McCauley" <nobull@mail.com> wrote in message
news:u965rac9oj.fsf@wcl-l.bham.ac.uk...
> "Dieter D'Hoker" <webmaster@neverseenbefore.com> writes:
>
> > I have this perl-gameserver , now sometimes it craches and I want
> > autorestart it then , so I definded
> >
> > $SIG{__DIE__} = \&SigDIE;
>
> You should $SIG{__DIE__} only as a last resort when you really need to
> intercept the execption handling process very close to the cause of
> the exception and when none of the more conventional flow control
> menchanisms work.
>
> If you want something with the semantics of an END block use an END block.
>
> However, you'd probably do better to take the restart mechanism
> completely outside the main process. Have a parent process that forks
> and waits then execs itself.
well that is a problem cause my shell I run the server on only alows me one
process ,
and forking does start an new process ...
--
Dieter D'Hoker
http://dieter.dhoker.com/
news:free.nl.dieter.dhoker & news:alt.nl.fan.dieter.dhoker
Tetrinet SeRVer : TSRV.COM
------------------------------
Date: 02 Mar 2003 11:22:10 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: FAQ proposal: Why can't I compare two strings using == ?
Message-Id: <slrnb63qb2.4ov.abigail@alexandra.abigail.nl>
M.J.T. Guy (mjtg@cus.cam.ac.uk) wrote on MMMCDLXX September MCMXCIII in
<URL:news:b3rqa3$21m$1@pegasus.csx.cam.ac.uk>:
[] Abigail <abigail@abigail.nl> wrote:
[] >You shouldn't blindly add "use strict" to your program if you don't
[] >know what it means, just because someone in some newsgroup said so.
[] >
[] >Turning on strictness does change the way Perl parses your program.
[] >That's something that shouldn't be taken lighthearted.
[]
[] I don't understand what you are getting at.
[]
[] It's fundamental to the concept of "use strict" that it doesn't change
[] the syntax (or semantics) of any valid Perl program; it just causes
[] some otherwise valid programs to be rejected.
Exactly. Rejecting otherwise valid program *IS* a change of syntax.
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
------------------------------
Date: Sun, 02 Mar 2003 16:13:39 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Feedback request: photobrowser
Message-Id: <b3ta9o$60j$1@news.dtag.de>
Tad McClellan wrote:
> You should probably have an explicit chdir() somewhere near
> the top of your program too.
Is that wise under mod_perl? (or if you want to port to mod_perl later)
->malte
------------------------------
Date: Sat, 1 Mar 2003 23:59:25 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: filename returned by server?
Message-Id: <slrnb637dt.4kd.tadmc@magna.augustmail.com>
Jef S <zaphod@frognet.net> wrote:
> if I send a
> request for something like http://www.mydomain.com I'd like to be
> able to find out if the file returned is index.htm, index.html,
> index.php, etc.
You can't.
This is a feature.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 2 Mar 2003 13:17:21 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Re: filename returned by server?
Message-Id: <Gun8a.9744$EN3.76651@newsfep4-glfd.server.ntli.net>
> request for something like http://www.mydomain.com I'd like to be
> able to find out if the file returned is index.htm, index.html,
> index.php, etc.
Further to the other comments given here, I'd suggest that one hacked up way of
doing it would be to request the page, note its ETag, then call all the other
files you 'suspect' it might be, and find one with a matching ETag.
Not the most stable method, but it all depends on what you're doing here..
writing a script for a quick job you need to do, or writing something you plan
to sell to giant corporations for $10,000 a shot.
Pete
------------------------------
Date: Sun, 2 Mar 2003 12:44:40 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Going around in circles with modules?
Message-Id: <20n8a.9693$EN3.75919@newsfep4-glfd.server.ntli.net>
Let's say I have a main program.. something.pl
something.pl has a number of global settings that are held within Settings.pm,
which is kept nice and simple so that people installing the program can simply
edit that one file.
Now.. something.pl uses a lot of subroutines that are in Subroutines.pm, so
something.pl simply uses Settings.pm and Subroutines.pm. Simple enough. But..
Subroutines.pm -also- needs to use Settings.pm.
Does this mean that 'Settings.pm' is imported twice, once into the program and
once into Subroutines? Is there now double the memory usage for it? Can Perl get
stuck in some sort of circular loop? I've got a lot of info on modules, but
haven't found anything that specifically mentions any problems with a bunch of
modules all calling each other in recursion.
Or, as I'm guessing, there's no 'loop' anyway.. since modules are only imported
into the calling code, and not all the way up the tree..? Perhaps I'm thinking
too hard on this!
Thanks in advance,
Pete
------------------------------
Date: Sun, 2 Mar 2003 13:15:05 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Re: Going around in circles with modules?
Message-Id: <zsn8a.9740$EN3.76610@newsfep4-glfd.server.ntli.net>
> Let's say I have a main program.. something.pl
I decided to conduct some research of my own into this. I created the set up as
I said.. and to my surprise I found that the subroutines module could 'see' the
stuff from my settings module, even though I didn't actually use 'use' to
reference it there.
For example ..
print &MySettings::db->{username};
.. worked fine from the MySubroutines module, even though the MySettings module
is only referenced in the main program 'something.pl'.
Is this because the main app has loaded MySettings into memory, and now
/anything/ can reference stuff in MySettings directly? My Perl book hints at
this but doesn't confirm it and tends to stick to the basics.
Pete
------------------------------
Date: Sun, 2 Mar 2003 08:42:23 -0600
From: Barry Kimelman <barryk2@SPAM-KILLER.mts.net>
Subject: Re: grep command in a perl script
Message-Id: <MPG.18cbd44a2b827be0989729@news.mts.net>
In article <a9c42696.0303010758.4933c272@posting.google.com>, Bakechad
(bakechad@ameritech.net) says...
> I am new to perl and programming in general. I grinded out the script
> below to convert color files to greyscale. The script works, but I
> would like to ignore the case in my grep statement to pickup files
> with both a .jpg & .JPG extension. I keep trying to add a -i to the
> grep statement, but no matter what syntax I try, it does not work.
>
> Thanks
>
> Chad
>
> #!/usr/bin/perl
>
> use warnings;
> use strict;
> use Image::Magick;
>
> my ($appfile, $extension, $startdir, $destdir, $of, $image, $fname,
> $pextension)
> ;
> $appfile = "_bw.";
> $extension = "jpg";
> my $cl1 = $ARGV[0];
> $startdir = "$cl1";
> $destdir = "$startdir/bw";
> if (not -d $destdir) {
> mkdir ($destdir);
> }
> opendir("photos", $startdir);
> my @files = readdir("photos");
> closedir("photos");
> my @ofs = grep /.jpg/, @files;
>
> foreach $of (@ofs) {
> ($fname, $pextension) = split(/\./, $of);
> $image = new Image::Magick;
> $image->Read("$startdir/$of");
>
> $image->Quantize(colorspace=>'gray');
>
> $image->write("$destdir/$fname$appfile$extension");
>
>
> }
>
my @ofs = grep /\.jpg$/i,@files; # case insensitive search
--
---------
Barry Kimelman
Winnipeg, Manitoba, Canada
email : bkimelman@hotmail.com
------------------------------
Date: Sun, 2 Mar 2003 15:12:25 +0100
From: "Hans" <qqhnieuwen.1@hccnet.nl>
Subject: how to read form output in perl procedure
Message-Id: <b3t3ds$bbh$1@news.hccnet.nl>
Hello Newsgroup,
I'm absolutely new to perl , so forgive me this stupid 2 questions.
Question 1 ; Why does read (STDIN...) etc. does not work?
From a html form I start the next script:
#!/usr/bin/perl
# Set Variables
$varnaam = "hans.html";
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
open (HA ,">$varnaam") || die "kan bestand niet openen!\n";;
print HA $buffer;
close (HA);
exit;
I thought that with this script, the contents of the buffer ( the
information which the user filled in in the form) was put in the file
hans.html.
Hans.html is generated by the script, but is empty.
question 2: perl debugger
I downloaded perl for Windows form the activestate website.
I would like to debug the script above, but when it is started from the
html-form (after pushing the right button) I am not able to debug and when
started from a dos commandline with "c:> perl -d test.pl" there is no form
data.
Is it possible to debug a script when the script is started after pushing
the right button in a html form?
Hans
**************************
If you want to reply via email please remove the double q
------------------------------
Date: Sun, 2 Mar 2003 14:39:00 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Re: how to read form output in perl procedure
Message-Id: <gHo8a.9858$EN3.77262@newsfep4-glfd.server.ntli.net>
Hans,
> I thought that with this script, the contents of the buffer ( the
> information which the user filled in in the form) was put in the file
> hans.html.
> Hans.html is generated by the script, but is empty.
Your code definitely won't work if you're using the GET method from your HTML
form, as it doesn't send the query through to the STDIN. POST does, however.
Either way, you shouldn't be doing it like that. Use the CGI module. It gives
you a quick and easy interface to CGI. A basic intro:
use CGI;
my $q = new CGI;
my @names = $q->param;
print $q->param("$_") for @names;
Read on at http://stein.cshl.org/WWW/software/CGI/cgi_docs.html
On your second question, it sounds like you really need to get something like
OpenPerl IDE. You can debug within that, and it's a nice easy interface. Take a
look at the screenshots and you may be convinced.
http://open-perl-ide.sourceforge.net/
Cheers,
Pete
------------------------------
Date: Mon, 03 Mar 2003 00:39:26 +1100
From: Allan Herriman <allan_herriman.hates.spam@agilent.com>
Subject: Re: Killing "process groups" on Win32
Message-Id: <l9246vk84qqmrg1vejor3fhid7molb9no6@4ax.com>
On 28 Feb 2003 17:06:19 -0800, kalinabears@hdc.com.au (Sisyphus)
wrote:
>Allan Herriman <allan_herriman.hates.spam@agilent.com> wrote in message news:<jnnr5v4b5t3mgobfvtb64jvjq7f841kfl2@4ax.com>...
>
><snip>
>> (Actually 2000 has "jobs" in its API, but these don't seem to
>> be available through Perl. In any case, they wouldn't work on NT.)
>>
><snip>
>
>'libwin' now contains the module 'Win32::Job' for controlling 'jobs'.
>Should ship as standard with AS perl, I think.
>But, yes .... no good on NT.
Thanks Rob, I wasn't aware of Win32::Job. This might be a good excuse
for retiring those NT machines...
Regards,
Allan.
------------------------------
Date: Sun, 2 Mar 2003 13:21:20 -0000
From: "Jade V Williams" <2001_jade@msn.com>
Subject: Looking for a utility to remove duplicates
Message-Id: <b3t0dp$1qu$1@wisteria.csv.warwick.ac.uk>
Does Perl have a utility to remove duplicates given certain criteria?
For example, an array contains (fruit, weight):
@fruits:
[0] Banana: 0.12
[1] Apple: 0.15
[2] Pear: 0.16
[3] Banana: 0.13
I'd like to remove all duplicates in fruit field and when deciding which one
to remove, remove the heaviest.
I did try coding this myself but after many, many lines of code it was
getting increasingly complex
Might it help to sort by weight first? I need to do this anyway, so before
or after the removal of duplicates would be good.
Thanks for any ideas you may have,
Jade
------------------------------
Date: Sun, 2 Mar 2003 13:38:39 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Re: Looking for a utility to remove duplicates
Message-Id: <FOn8a.9772$EN3.76406@newsfep4-glfd.server.ntli.net>
Jade,
> I did try coding this myself but after many, many lines of code it was
> getting increasingly complex
>
> Might it help to sort by weight first? I need to do this anyway, so before
> or after the removal of duplicates would be good.
It'd help if you used a hash instead. That way you can do the checking while the
data is being loaded, rather than after it's all in an array.
It sounds, however, as if you're trying to get an array to do a hashes job. To
humor this, I wrote this slightly messier solution to your problem..
__START__
my @fruits = ("Banana: 0.12", "Apple: 0.15", "Pear: 0.16", "Banana: 0.13");
my %newfruit = ();
foreach (@fruits) {
(my $fruitname, my $weight) = /^(.*?)\:\s*(.*?)$/;
if ($newfruit{$fruitname} < $weight) { $newfruit{$fruitname} = $weight; }
}
print "$_ - $newfruit{$_}\n" for keys %newfruit;
__END__
.. which results in ..
Apple - 0.15
Banana - 0.13
Pear - 0.16
But it'd be a lot easier and tidier with a hash.
Pete
------------------------------
Date: Sun, 2 Mar 2003 14:15:42 -0000
From: "Jade V Williams" <2001_jade@msn.com>
Subject: Re: Looking for a utility to remove duplicates
Message-Id: <b3t3j4$3dv$1@wisteria.csv.warwick.ac.uk>
"Peter Cooper" <newsfeed2@boog.co.uk> wrote in message
news:FOn8a.9772$EN3.76406@newsfep4-glfd.server.ntli.net...
> Jade,
>
> > I did try coding this myself but after many, many lines of code it was
> > getting increasingly complex
> >
> > Might it help to sort by weight first? I need to do this anyway, so
before
> > or after the removal of duplicates would be good.
>
> It'd help if you used a hash instead. That way you can do the checking
while the
> data is being loaded, rather than after it's all in an array.
>
> It sounds, however, as if you're trying to get an array to do a hashes
job. To
> humor this, I wrote this slightly messier solution to your problem..
>
> __START__
>
> my @fruits = ("Banana: 0.12", "Apple: 0.15", "Pear: 0.16", "Banana:
0.13");
> my %newfruit = ();
>
> foreach (@fruits) {
> (my $fruitname, my $weight) = /^(.*?)\:\s*(.*?)$/;
> if ($newfruit{$fruitname} < $weight) { $newfruit{$fruitname} =
$weight; }
> }
>
> print "$_ - $newfruit{$_}\n" for keys %newfruit;
>
> __END__
>
> .. which results in ..
>
> Apple - 0.15
> Banana - 0.13
> Pear - 0.16
>
> But it'd be a lot easier and tidier with a hash.
>
> Pete
>
Thanks Pete, but I experienced a few problems.
I got this error 3 times:
Use of unitialised value in numeric lt (() at line 184
Also, this code removes the lightest, not the heaviest! I'd like Banana 0.12
to be selected, and the 0.13 'deleted'.
Your thoughts?
Thank-you,
Jade
------------------------------
Date: Sun, 2 Mar 2003 14:32:34 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Re: Looking for a utility to remove duplicates
Message-Id: <cBo8a.9850$EN3.77226@newsfep4-glfd.server.ntli.net>
> Also, this code removes the lightest, not the heaviest! I'd like Banana 0.12
> to be selected, and the 0.13 'deleted'.
You shouldn't /really/ be using code when you don't understand what it does.
Simply switching < to > would solve the above problem.
The following works, BUT it is /not/ the ideal solution here. You don't give
enough information on how you're getting the information for me to suggest how
putting the data in a hash in the beginning might help you more here. But.. the
following works anyway, but it is as far from elegant as you can get:
__START__
my @fruits = ("Banana: 0.12", "Apple: 0.15", "Pear: 0.16", "Banana: 0.13");
my %newfruit = ();
foreach (@fruits) {
(my $fruitname, my $weight) = /^(.*?)\:\s*(.*?)$/;
if (exists($newfruit{$fruitname})) {
if ($newfruit{$fruitname} > $weight) { $newfruit{$fruitname} = $weight; }
} else {
$newfruit{$fruitname} = $weight;
}
}
print "$_ - $newfruit{$_}\n" for keys %newfruit;
__END__
I advise you don't use it and rethink through your data structure instead. But
if you're just looking for a quick answer, there it is.
Cheers,
Pete
------------------------------
Date: Sun, 2 Mar 2003 14:53:28 -0000
From: "Jade V Williams" <2001_jade@msn.com>
Subject: Re: Looking for a utility to remove duplicates
Message-Id: <b3t5s5$4le$1@wisteria.csv.warwick.ac.uk>
>You don't give
> enough information on how you're getting the information for me to suggest
how
> putting the data in a hash in the beginning might help you more here.
Ok, this is where my data comes from:
I read in a data file into an array. Each line in the file becomes an
element in the array.
Then, with this array (@fruits_data), I split each data line into several
different fields.
With this information, I create a new array (@fruits), placing selected
fields ($fruitname and $weight) in each element.
Bearing this in mind, what do you think would help? (Your solution does work
but you are right, it is not ideal!)
J
------------------------------
Date: Sun, 2 Mar 2003 15:48:17 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Re: Looking for a utility to remove duplicates
Message-Id: <bIp8a.9962$EN3.77742@newsfep4-glfd.server.ntli.net>
Jade wrote:
> With this information, I create a new array (@fruits), placing selected
> fields ($fruitname and $weight) in each element.
It's at this stage you want to use a hash. Instead of creating a new array and
placing the fields into each element, create a hash and use the 'fruitname'
field as the key, and the 'weight' field as the value. Like so..
{{ yourloop goes here }}
$fruits{$fruitname} = $weight;
{{ /yourloop }}
as opposed to push $fruits, "$fruitname: $weight"; as you're doing at present.
However, you want only the -lowest- value going in.. and the above line won't
help you do that.. it'll just keep the most recent weight there. You need
something like:
$fruits{$fruitname} = $weight if !exists($fruits{$fruitname});
$fruits{$fruitname} = $weight if $fruits{$fruitname} > $weight;
Line 1 makes the '$fruitname' element (say, Banana, or Coconut) equal the weight
if the element does not already exist in the hash.
Line 2 makes the '$fruitname' element equal the weight IF THE WEIGHT ALREADY IN
THAT ELEMENT IS HIGHER THAN THE NEW ONE. This means you end up with the lowest
weight for each element each time.
To itererate through the hash later on, you don't work in the same way as an
array.. but you should be able to work it out yourself from this simple code:
foreach (keys %fruits) {
print "$_ - $fruits{$_}\n";
}
Refer to a good Perl book (or documentation) on hashes. They're a great way of
organising this sort of data.
Cheers,
Pete
------------------------------
Date: Sun, 02 Mar 2003 12:08:32 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: moving a string 'string' into perl script
Message-Id: <b3soqn$1p1j1q$1@ID-184292.news.dfncis.de>
Doron Stein wrote:
> Apparently when i do
>
> perl_script 'string'
>
> and inside the script i have
>
> $in = shift ;
> print $in
>
> i get
>
> string
>
> ( without the ' ' )
>
> The same is true when the input is "string".
> In other words , the shell strip both '' and "".
> How do i pass on the exact input without the stripping?
I tested on my W98 installation, and the singlequotes were not
"stripped", while the doublequotes were. The behaviour in this respect
is obviously OS dependent.
I don't know if you can tell the OS not to strip. To retain
doublequotes, you can do:
perl_script \"string\"
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 2 Mar 2003 13:17:12 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: moving a string 'string' into perl script
Message-Id: <b3t08o$o3a$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Doron Stein:
> Apparently when i do
>
> perl_script 'string'
>
>
> and inside the script i have
>
>
> $in = shift ;
>
> print $in
>
>
> i get
>
> string
>
> ( without the ' ' )
>
> The same is true when the input is "string".
>
> In other words , the shell strip both '' and "".
>
> How do i pass on the exact input without the stripping?
This is almost a self-answering question. As you correctly remarked: The
shell drops them so this is not even a Perl question (the Perl script
can't process what it doesn't receive).
Hint: Escape the characters you want to pass verbatimly to your script:
perl script \'string\'
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: 2 Mar 2003 14:46:34 GMT
From: Tina Mueller <usenet@tinita.de>
Subject: Re: moving a string 'string' into perl script
Message-Id: <tinhb4n0j$11f$tina@news01.tinita.de>
Doron Stein <dostein@cisco.com> wrote:
> Apparently when i do
> perl_script 'string'
> and inside the script i have
> $in = shift ;
> print $in
> i get
> string
> ( without the ' ' )
> The same is true when the input is "string".
> In other words , the shell strip both '' and "".
> How do i pass on the exact input without the stripping?
perl_script '"string"'
or
perl_script "'string'"
but this has got, as others pointed out, nothing to do with perl.
hth, tina
--
http://www.tinita.de/ \ enter__| |__the___ _ _ ___
http://Movies.tinita.de/ \ / _` / _ \/ _ \ '_(_-< of
http://www.perlquotes.de/ \ \ _,_\ __/\ __/_| /__/ perception
http://www.tinita.de/peace/link.html - Spread Peace
------------------------------
Date: Sun, 2 Mar 2003 12:33:31 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Re: my own "modules" for want of a better name
Message-Id: <HRm8a.9680$EN3.76349@newsfep4-glfd.server.ntli.net>
> directories that perl scans when use()ing a module. $FindBin::Bin is the
> actual path of your script so the above will work if your module is in
> the same directory as your script.
Do you know how common this module is? I have a popular script that I'm
reimplementing to use packages and do everything the proper way, and I don't
want to release something that has poor support.
Previously I have used 'cwd' for such things, since I've found it with every
distribution and it also gives the current directory.. or is there a flaw with
that method?
Pete
------------------------------
Date: Sun, 2 Mar 2003 07:47:00 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: my own "modules" for want of a better name
Message-Id: <slrnb642qk.cfe.tadmc@magna.augustmail.com>
Peter Cooper <newsfeed2@boog.co.uk> wrote:
[ please provide an attribution when you quote someone ]
>> $FindBin::Bin is the
>> actual path of your script
> Do you know how common this module is?
It is a "core module" (ie. it is listed in the "Standard Modules"
section in perltoc.pod) so it comes with the perl distribution.
I do not know at what perl version it became "core".
> I don't
> want to release something that has poor support.
>
> Previously I have used 'cwd'
Then you should not rely on OS-specific features.
Use the Cwd.pm module to find the current working directory.
> for such things, since I've found it with every
> distribution and it also gives the current directory.. or is there a flaw with
^^^^^^^^^^^^^^^
> that method?
Well yes, seeing as they are different things. :-)
FindBin.pm finds the directory where your program is.
Cwd.pm finds your current working directory.
They are completely different concepts, though they may end up
resolving to the same directory in some cases.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 2 Mar 2003 15:51:44 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Re: my own "modules" for want of a better name
Message-Id: <pLp8a.9970$EN3.77032@newsfep4-glfd.server.ntli.net>
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnb642qk.cfe.tadmc@magna.augustmail.com...
> FindBin.pm finds the directory where your program is.
> Cwd.pm finds your current working directory.
>
> They are completely different concepts, though they may end up
> resolving to the same directory in some cases.
Fair enough, I've tended to find they're always the same, but I can think of a
few situations (not Perl ones) where this might not be the case.
Thanks for the help, Tad!
Cheers,
Pete
------------------------------
Date: 02 Mar 2003 11:48:40 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: recursively adding arrays of arrays
Message-Id: <slrnb63rso.4ov.abigail@alexandra.abigail.nl>
ravlin (jhayden@usa.com) wrote on MMMCDLXIX September MCMXCIII in
<URL:news:pG28a.57211$If5.3162089@twister.southeast.rr.com>:
||
|| var2=2 # $testgroup[0]{'vars'}[1] = "var2=2"
Ok, so $testgroup [0] is a reference to a hash.
|| { # $testgroup[0][0]
But now, $testgroup [0] is a reference to an array.
What's it going to be?
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
------------------------------
Date: 2 Mar 2003 03:23:48 -0800
From: massion@gmx.de (FMAS)
Subject: Re: search algorithm needed
Message-Id: <f0b3f4c9.0303020323.1cc41118@posting.google.com>
Hi Benjamin,
Thank you very much for your help, it is much appreciated. As I am a
novice at Perl, it'll take a bit of time to test out all the
suggestions.
You want to have an idea of the type of phrases I am processing.
Actually there are bilingual entries separated by a tab (I left this
out of my question and script in order to keep things simple). Typical
entries are like (with a tab between the 2 languages):
#################
- Grey-scale-value threshold between bars and gaps (with max.GSV
range)- Width thresholds between bars with 1-/2-/3-/4-bit widths or
gaps- Length of bar codes in pixels (max.256 P, 80%205 P, 60%154 P)-
Number of bars + gaps in bar code- Number of bits - Grauwert-Schwelle
zwischen Strichen und Lücken (mit max.GW-Bereich)- Breiten-Schwellen
zwischen 1/2/3/4 Bit breiten Strichen bzw. Lücken- Länge des Barcodes
in Pixel (max.256 P., 80%205 P., 60%154 P.)- Anzahl Striche + Lücken
im Barcode- Anzahl Bits
- gripper finger opening/closing cam (3). -Kurve zum Schließen/Öffnen
der Greiferfinger (3).
A sensor scans the container after the infeed starwheel and transmits
a signal to the electronic components. Ein Sensor tastet den Behälter
nach dem Einlaufstern ab und gibt an die Elektronik ein Signal.
With the exception of the "Operation" programme, SB 36 is always in
position A. The CIP cups remain locked during the entire CIP
programme. SB 36 ist mit Ausnahme von Programm "Betrieb" immer auf
Stellung A. Die Spültulpen bleiben während des CIP-Programms ständig
verriegelt.
#################
The terms list with (English) terms is extracted from such phrases,
e.g. "gripper finger", "CIP cup"; "bar code", "starwheel"....
I hope this answers your question.
And again, thanks a lot to you and to the other folks for the replies
and suggestions.
Francois
------------------------------
Date: 2 Mar 2003 07:46:09 -0800
From: dwlepage@yahoo.com (david)
Subject: Re: string manipulations
Message-Id: <b09a22ae.0303020746.2538db7f@posting.google.com>
tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnb627nm.3p2.tadmc@magna.augustmail.com>...
> david <dwlepage@yahoo.com> wrote:
>
> > Here is what my data file looks like:
>
> [snip]
>
> > Comment: 5XY2QD3
>
> > and replace this value with any instance of 'dlepage.password' in the
> > file.
>
> > Comment: P08233
>
>
> Why did that value change?
Thanks for the advice. I will give it a try. Do you think that will work if I
have multiple data lines that are unique for each individual? i.e.
dn: UserId=dlepage,User
objectclass: User
ldifGroup: Groupname
Comment: 5XY2QD3
ModifiedBy: dave
ModificationDateTime: 2003/02/27 17:23:46.207 (GMT)
UserId: dlepage
PasswdId: 1:dlepage.password
dn: AuthenticatorId=dlepage.password, Authenticator
objectclass: Authenticator
StoredAt: AuthenticatorId=dlepage.password
EntryId: Authenticator-dlepage.password-2003/01/28 13:10:08.943 (GMT)
(on 10.65.63.140:5040)-2039
AuthenticatorId: dlepage.password
dn: UserId=testuser,User
objectclass: User
ldifGroup: Groupname
Comment: IKG4643
ModifiedBy: dave
ModificationDateTime: 2003/02/27 17:23:46.207 (GMT)
UserId: testuser
PasswdId: 1:testuser.password
dn: AuthenticatorId=testuser.password, Authenticator
objectclass: Authenticator
StoredAt: AuthenticatorId=testuser.password
EntryId: Authenticator-testuser.password-2003/01/28 13:10:08.943 (GMT)
(on 10.65.63.140:5040)-2039
AuthenticatorId: testuser.password
Also, the data didn't change,I made a cut/paste error - sorry.
Thanks,
------------------------------
Date: Sun, 2 Mar 2003 12:35:58 +0100
From: "henq" <hvtijen@hotwail.com>
Subject: Re: The perl CD bookshelf
Message-Id: <3e61ec25$0$23907$8fcfb86b@news.wanadoo.nl>
try
wget -m www.perldoc.com
:-)
"Dave" <browndog64@hotmail.com> schreef in bericht
news:ae22e35b.0303012346.4f8b7098@posting.google.com...
> I've lost my copy of "The perl CD bookshelf", any suggestions on what I
can do?
------------------------------
Date: Sun, 2 Mar 2003 12:12:57 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Re: The perl CD bookshelf
Message-Id: <GRm8a.9679$EN3.76349@newsfep4-glfd.server.ntli.net>
> I've lost my copy of "The perl CD bookshelf", any suggestions on what I can
do?
Try looking in the least obvious of places, because things are always where you
look for them the last.
Pete
------------------------------
Date: Sun, 2 Mar 2003 14:06:49 -0000
From: "Peter Cooper" <newsfeed2@boog.co.uk>
Subject: Re: The perl CD bookshelf
Message-Id: <4do8a.9813$EN3.77064@newsfep4-glfd.server.ntli.net>
> I've lost my copy of "The perl CD bookshelf", any suggestions on what I can
do?
BTW, I was looking on Google for some Perl related stuff earlier, and found what
I wanted.. then realised I was in an online rip off of the Perl CD Bookshelf.
It's a Russian site. Not very hard to find, this exercise is left to the reader
:-)
Pete
------------------------------
Date: Sun, 02 Mar 2003 15:14:25 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: The perl CD bookshelf
Message-Id: <ldp8a.55486$ep5.30300@nwrddc02.gnilink.net>
Dave wrote:
> I've lost my copy of "The perl CD bookshelf", any suggestions on what
> I can do?
Did you check your refrigerator already? According to a study a surprisingly
large number of people find their lost TV remotes in the frigde. Maybe your
book went the same way?
jue
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 4650
***************************************