[12604] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 2 20:57:43 1999

Date: Fri, 2 Jul 1999 17:49:04 -0700 (PDT)
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, 2 Jul 1999     Volume: 9 Number: 9

Today's topics:
    Re: getting script source (Bart Lateur)
    Re: getting script source <ngaccess@millions.net>
    Re: getting script source (Bart Lateur)
    Re: getting script source <nospam.newton@gmx.net>
    Re: getting script source <tchrist@mox.perl.com>
    Re: getting script source <ngaccess@millions.net>
    Re: getting script source (Greg Bacon)
    Re: getting script source <tchrist@mox.perl.com>
    Re: getting script source <tchrist@mox.perl.com>
    Re: getting script source <cassell@mail.cor.epa.gov>
    Re: getting script source <cassell@mail.cor.epa.gov>
    Re: getting script source flounder99@my-deja.com
    Re: getting script source (I R A Aggie)
    Re: getting script source <gellyfish@gellyfish.com>
    Re: getting script source (Alastair)
    Re: getting script source <ngaccess@millions.net>
    Re: getting script source (Lee)
    Re: getting script source (Tad McClellan)
    Re: getting script source (Abigail)
    Re: getting script source (Abigail)
    Re: getting script source <ngaccess@millions.net>
    Re: GIFgraph output to web page johnalewis@my-deja.com
        global substitution bing-du@tamu.edu
    Re: global substitution (Greg Bacon)
    Re: global substitution <uri@sysarch.com>
    Re: global substitution (Greg Bacon)
    Re: global substitution (Abigail)
        Hash problem... <not@gonna.tell>
    Re: Hash problem... <dodger@dodger.org>
    Re: Hash problem... <Not@gonna.tell>
    Re: Help for Process <cantrela@agcs.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Fri, 02 Jul 1999 08:12:00 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: getting script source
Message-Id: <3780737b.4821810@news.skynet.be>

Tom Christiansen wrote:

>:Is it possible to get a script to return the entire script contents?
>
>open 0 and print <0>;


Eek! That's wicked. How does it work?

From perlfunc->open:

	If EXPR is omitted, the scalar
        variable of the same name as the FILEHANDLE contains the
        filename.

Urm... I think that this reads the file from $0. That's the script
alright. "0" as a filehandle is a bit, huh, a new concept to me.

	Bart.


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

Date: Fri, 02 Jul 1999 08:40:54 -0400
From: pop <ngaccess@millions.net>
Subject: Re: getting script source
Message-Id: <377CB356.2246454D@millions.net>

No people (thanks) ... I'm talking about "remotely" ... Can you get my
script on my server (or anyone's) to 'send itself' to you on a different
network where you thereby have the actual source code?

pop wrote:
> 
> Hello all,
> 
> Is it possible to get a script to return the entire script contents?
> 
> Or IOW, can someone get a script to 'send' itself to them?
> 
> I know it will if its setup wrong or misconfigured but I am speaking of
> a 'properly configured' working script.
> 
> TIA


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

Date: Fri, 02 Jul 1999 13:21:45 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: getting script source
Message-Id: <377ebbdd.8540178@news.skynet.be>

pop wrote:

>No people (thanks) ... I'm talking about "remotely" ... Can you get my
>script on my server (or anyone's) to 'send itself' to you on a different
>network where you thereby have the actual source code?

What's wrong with the code you got so far? The script can read itself as
a text file (filename is in $0), therefore it can send itself to other
computers (e.g. using LWP), or mail itself.

	Bart.


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

Date: Fri, 02 Jul 1999 16:11:32 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net>
Subject: Re: getting script source
Message-Id: <377CC894.242C1F38@gmx.net>

Bart Lateur wrote:
> 
> pop wrote:
> 
> >No people (thanks) ... I'm talking about "remotely" ... Can you get my
> >script on my server (or anyone's) to 'send itself' to you on a different
> >network where you thereby have the actual source code?
> 
> What's wrong with the code you got so far? The script can read itself as
> a text file (filename is in $0), therefore it can send itself to other
> computers (e.g. using LWP), or mail itself.

Or, if the script has __END__ at the end, you can open DATA and seek to
the beginning before reading :) (I think I saw that done somewhere).

Cheers,
Philip


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

Date: 2 Jul 1999 08:41:27 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: getting script source
Message-Id: <377ccf97@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, pop <ngaccess@millions.net> writes:
:No people (thanks) ... I'm talking about "remotely" ... Can you get my
:script on my server (or anyone's) to 'send itself' to you on a different

s/server/computer/

:network where you thereby have the actual source code?

s/network/computer/

This is not a Perl issue.

--tom
-- 
: There may be 2 or three ways to perform a particular task, but there will
: not be 10,000 as there are in perl.
I think you may be exaggerating slightly.  Perl isn't that good yet.
        -- Larry Wall, 5 Jun 91 5:11:004GMT


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

Date: Fri, 02 Jul 1999 10:50:25 -0400
From: pop <ngaccess@millions.net>
Subject: Re: getting script source
Message-Id: <377CD1B1.4A78705F@millions.net>



Bart Lateur wrote:
> 
> pop wrote:
> 
> >No people (thanks) ... I'm talking about "remotely" ... Can you get my
> >script on my server (or anyone's) to 'send itself' to you on a different
> >network where you thereby have the actual source code?
> 
> What's wrong with the code you got so far? The script can read itself as
> a text file (filename is in $0), therefore it can send itself to other
> computers (e.g. using LWP), or mail itself.
> 
>         Bart.

You don't have any code 'so far' ... you're on a different network,
remember?

IOW, any script on any server anywhere on the internet ... can other
people get the source?

Put another way, how do you prevent anyone from getting your source code
to custom scripts that are not 'public'? 

How would you prevent that from happening?


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

Date: 2 Jul 1999 14:50:53 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: getting script source
Message-Id: <7lijkd$9f6$6@info2.uah.edu>

In article <377ccf97@cs.colorado.edu>,
	Tom Christiansen <tchrist@mox.perl.com> writes:
: s/network/computer/

But the network is the computer!  Sun wouldn't lie to us, would they? :-)

Greg
-- 
The most incomprehensible thing about the universe is that it is
comprehensible. 
    -- Albert Einstein


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

Date: 2 Jul 1999 09:04:27 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: getting script source
Message-Id: <377cd4fb@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, pop <ngaccess@millions.net> writes:
:IOW, any script on any server anywhere on the internet ... can other
:people get the source?

:Put another way, how do you prevent anyone from getting your source code
:to custom scripts that are not 'public'? 

:How would you prevent that from happening?

There's some fundamental confusion here, and I'm not quite sure
whre it is.  I ran into it the other day with a non-computer friend,
too, however.  

Just because you've got a machine that's connected to the net doesn't
mean that anybody can do anything to it from anywhere that an authenticated
user with a proper account on that machine is able to do.

Does that make sense?

It's still not related to perl, though.

--tom
-- 
It's all magic.  :-)    --Larry Wall in <7282@jpl-devvax.JPL.NASA.GOV>


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

Date: 2 Jul 1999 09:06:06 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: getting script source
Message-Id: <377cd55e@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, Greg Bacon <gbacon@cs.uah.edu> writes:
:But the network is the computer!  Sun wouldn't lie to us, would they? :-)

Allegedly seen on a T-shirt in Mountain View:

    The computer is the computer.
    The network is the network.
    Sorry about the confusion.
	--Sun Microsystems

You know, I actually wrote "Sun Microsoft" there the first
time around.  Scary.  

--tom
-- 
As of next week, passwords will be entered in Morse code.


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

Date: Fri, 02 Jul 1999 09:45:59 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: getting script source
Message-Id: <377CECC7.D9F707C6@mail.cor.epa.gov>

pop wrote:
> [snip]
> Put another way, how do you prevent anyone from getting your source code
> to custom scripts that are not 'public'?
> 
> How would you prevent that from happening?

Oh!  A security issue!  That really wasn't clear from your
original post(s).

Well, the best way to prevent this is to have your server set
up properly.  But that makes this a non-Perl problem.  If you
have concerns about the security of your ISP's machine, you
should probably read some of the docs for whichever web server
your ISP runs, talk to your ISP about available security
features [such as .htaccess] and about security holes, then
implement the system your ISP prefers that you use [assuming
it's a reasonable one].  If, after reading up on this, you
find that your ISP prefers an unsafe security model, then
I suggest you get yourself a new ISP.

Oh, and you can look in the newsgroups devoted to CGI, web
security issues, and your ISP's particular web server.  But
since it's not a Perl issue, I guess you won't be back here.
 
been nice talkin' at ya,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 02 Jul 1999 09:48:08 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: getting script source
Message-Id: <377CED48.2A06AA2E@mail.cor.epa.gov>

Tom Christiansen wrote:
> [snip]
> Allegedly seen on a T-shirt in Mountain View:
> 
>     The computer is the computer.
>     The network is the network.
>     Sorry about the confusion.
>         --Sun Microsystems
> 
> You know, I actually wrote "Sun Microsoft" there the first
> time around.  Scary.

Umm, there's a difference these days?

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 02 Jul 1999 17:19:54 GMT
From: flounder99@my-deja.com
Subject: Re: getting script source
Message-Id: <7lisbd$hc6$1@nnrp1.deja.com>

In article <377BF4C5.6E4E3E70@millions.net>,
  pop <ngaccess@millions.net> wrote:
> Hello all,
>
> Is it possible to get a script to return the entire script contents?
>
> Or IOW, can someone get a script to 'send' itself to them?
>
> I know it will if its setup wrong or misconfigured but I am speaking
of
> a 'properly configured' working script.
>
> TIA
>

Here is an example using CGI

use strict;
use CGI qw(:standard);

my $query = new CGI;

#send the source if requested

if (param('SENDSOURCE')) {
	open ME, $0 or die "can't find myself?";
	print header('text/plain');
	print <ME>;
	exit;
}

print header();
print start_html(-title => 'My Web Page');
print h1("This is my web page");

#add send source button

print start_form(-name => 'sendsource', -method => 'POST', -action =>
url);
print hidden(-name => 'SENDSOURCE', -default => 1);
print submit(-value => 'View Script Source');
print end_form();

print end_html();
exit;


flounder


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 2 Jul 1999 19:26:14 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: getting script source
Message-Id: <slrn7nq4n3.6ie.fl_aggie@thepentagon.com>

On Fri, 02 Jul 1999 09:48:08 -0700, David Cassell
<cassell@mail.cor.epa.gov>, in <377CED48.2A06AA2E@mail.cor.epa.gov>
wrote: 

+ Tom Christiansen wrote:

+ > You know, I actually wrote "Sun Microsoft" there the first
+ > time around.  Scary.

+ Umm, there's a difference these days?

One has a functional operating system, and the other a functional
marketing system.

James - both have fairly dysfunctional lawyers, tho...



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

Date: 2 Jul 1999 21:00:04 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: getting script source
Message-Id: <7lj98k$1rn$1@gellyfish.btinternet.com>

On Fri, 02 Jul 1999 08:40:54 -0400 pop wrote:
> No people (thanks) ... I'm talking about "remotely" ... Can you get my
> script on my server (or anyone's) to 'send itself' to you on a different
> network where you thereby have the actual source code?
> 

Unless you have a Microsoft IIS that is not patched against the ::$DATA
security hole / bug (whatever) then unless you make special provision to
allow people access to your source then this is not possible - however 
you should have asked in one of the comp.infosystems.www.servers.*
groups in the first place.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Fri, 02 Jul 1999 22:08:02 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: getting script source
Message-Id: <slrn7nqhn2.5q.alastair@calliope.demon.co.uk>

pop <ngaccess@millions.net> wrote:
>Put another way, how do you prevent anyone from getting your source code
>to custom scripts that are not 'public'? 

This is a misconception. Security prevents people 'grabbing' your source. If
things are misconfigured though, who knows? You have security, yes?


-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: Fri, 02 Jul 1999 18:24:11 -0400
From: pop <ngaccess@millions.net>
Subject: Re: getting script source
Message-Id: <377D3C0B.2D9755B9@millions.net>

Tom Christiansen wrote:
> 
>      [courtesy cc of this posting mailed to cited author]
> 
> In comp.lang.perl.misc, pop <ngaccess@millions.net> writes:
> :IOW, any script on any server anywhere on the internet ... can other
> :people get the source?
> 
> :Put another way, how do you prevent anyone from getting your source code
> :to custom scripts that are not 'public'?
> 
> :How would you prevent that from happening?
> 
> There's some fundamental confusion here, and I'm not quite sure
> whre it is.  I ran into it the other day with a non-computer friend,
> too, however.
> 
> Just because you've got a machine that's connected to the net doesn't
> mean that anybody can do anything to it from anywhere that an authenticated
> user with a proper account on that machine is able to do.
> 
> Does that make sense?
> 

Certainly that makes sense. I understand that completely, however you
obviously (my fault) do not understand what I am asking.

> It's still not related to perl, though.
> 

Since the scripts are written in perl I most certainly think it is
related. (has to do with the internal workings of perl) If it was
another language I would have went to that newsgroup.

The following scenario is the '''opposite''' of what I am asking ... I
want to try to 'protect' the scripts sorce code from being seen.

You (anyone) have a custom written script (perl) running on your web
server. (web server on a computer with 755 permission (standard for
script on webserver))
I (anyone) access the script through the internet. (network)
Can I (anyone) 'trick', 'trigger', 'coerce' 'torture' or otherwise make
make the script (source code) send itself (source code) back to me where
I would then have your copywrited source code? (any trick 'keywords' or
'codes' or whatever that can be sent to it to get it to do this)

I do not want to pay for 'copywrited' custom source code if you (anyone)
can access it and reuse it as your own or whatever.

The author says it can't be done - I want a second (or third) opinion
but did not know it was that difficult to understand.

I would have thought it was a 'common' concern.


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

Date: Fri, 02 Jul 1999 17:33:29 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: getting script source
Message-Id: <B3A2A86996689522A@0.0.0.0>

In article <377BF4C5.6E4E3E70@millions.net>,
pop <ngaccess@millions.net> wrote:

>Is it possible to get a script to return the entire script contents?

I think the question you're trying to ask is:

Can any Joe with a web browser swipe the source to my nifty cgi script?

No.

However, all ISPs that I've dealt with have been set up so that anyone with
telnet or ftp access can wander in and grab them.

Lee




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

Date: Fri, 2 Jul 1999 14:50:08 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: getting script source
Message-Id: <0l1jl7.6r3.ln@magna.metronet.com>

pop (ngaccess@millions.net) wrote:


: You don't have any code 'so far' ... you're on a different network,
: remember?


   He was talking about the code in the followups to your question.


: IOW, any script on any server anywhere on the internet ... can other
: people get the source?


   Not if the server is configured properly.

   [ Perl does not have "a server". You are in the wrong newsgroup ]


: Put another way, how do you prevent anyone from getting your source code
: to custom scripts that are not 'public'? 


   Configure the server correctly.

   This still is completely off-topic for the Perl newsgroup.


: How would you prevent that from happening?

   Configure the server correctly.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 2 Jul 1999 19:03:17 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: getting script source
Message-Id: <slrn7nqkpk.31h.abigail@alexandra.delanet.com>

pop (ngaccess@millions.net) wrote on MMCXXXI September MCMXCIII in
<URL:news:377CD1B1.4A78705F@millions.net>:
() 
() Put another way, how do you prevent anyone from getting your source code
() to custom scripts that are not 'public'? 

You hire a competent system administrator. Your question has nothing
to do with Perl.


Followups set.


Abigail
-- 
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))


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


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

Date: 2 Jul 1999 19:06:09 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: getting script source
Message-Id: <slrn7nqkv0.31h.abigail@alexandra.delanet.com>

Tom Christiansen (tchrist@mox.perl.com) wrote on MMCXXXI September
MCMXCIII in <URL:news:377cd55e@cs.colorado.edu>:
%% 
%% Allegedly seen on a T-shirt in Mountain View:
%% 
%%     The computer is the computer.
%%     The network is the network.
%%     Sorry about the confusion.
%% 	--Sun Microsystems


I want such a shirt!



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


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


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

Date: Fri, 02 Jul 1999 20:09:03 -0400
From: pop <ngaccess@millions.net>
Subject: Re: getting script source
Message-Id: <377D549F.752834E9@millions.net>

Lee wrote:
> 
> In article <377BF4C5.6E4E3E70@millions.net>,
> pop <ngaccess@millions.net> wrote:
> 
> >Is it possible to get a script to return the entire script contents?
> 
> I think the question you're trying to ask is:
> 
> Can any Joe with a web browser swipe the source to my nifty cgi script?
> 
> No.
> 
> However, all ISPs that I've dealt with have been set up so that anyone with
> telnet or ftp access can wander in and grab them.
> 
> Lee

Thanks Lee,

Now you're getting close ... 

I'm not concerned with 'physical access' type nabbing, (ftp, directory
listings, telnet, etc) but rather some 'internal' code or function or
keywords or whatever that can make the script 'hurl' itself?


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

Date: Fri, 02 Jul 1999 23:20:46 GMT
From: johnalewis@my-deja.com
Subject: Re: GIFgraph output to web page
Message-Id: <7ljhg5$pet$1@nnrp1.deja.com>

Kevin,

Here is a sample program that does
what I think you want:


#!/usr/bin/perl

use CGI qw(:standard);
use GIFgraph::bars;
use strict;

my $form = new CGI;

my @data = (
    ["1st","2nd","3rd","4th","5th","6th","7th",
"8th", "9th"],
    [    5,   12,   24,   33,   19,    8,    6,
15,    21],
    [    1,    2,    5,    6,    3,  1.5,    1,
3,     4],
);

my $graph = new GIFgraph::bars();

$graph->set(
        x_label => 'X Label',
        y_label => 'Y Label',
        title => 'Two Data Sets',
        long_ticks => 1,
        y_max_value => 40,
        y_tick_number => 8,
        y_label_skip => 2,
        bar_spacing => 4,
);

$graph->set_legend('Data set 1','Data set 2');

print $form->header(-type=>'image/gif'),
      $graph->plot(\@data);

exit;


In article <7k1mi9$po1$1@reznor.larc.nasa.gov>,
  "Kevin Marlowe" <k.l.marlowe@larc.nasa.gov>
wrote:
> Does anyone have an example of a GIFgraph plot
that writes directly to
> stdout in such a way that it is displayed in a
browser after being called as
> a cgi? Thanks - KLM


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 02 Jul 1999 15:43:43 GMT
From: bing-du@tamu.edu
Subject: global substitution
Message-Id: <7limnc$f0e$1@nnrp1.deja.com>

Hi,

Can anybody remind me the exact perl command for doing global
subsitution on a file?

perl -ei 's/Employee/Faculty\/Student/g' myfile  just did not work? Why?

It's quite urgent.  Thanks in advance for your kind help.

Bing


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 2 Jul 1999 15:57:04 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: global substitution
Message-Id: <7lingg$afh$1@info2.uah.edu>

In article <7limnc$f0e$1@nnrp1.deja.com>,
	bing-du@tamu.edu writes:
: perl -ei 's/Employee/Faculty\/Student/g' myfile
:
: just did not work? Why?

Don't say "X didn't work".  Instead say what it did do and how that
was different from what you expected.

: It's quite urgent.  Thanks in advance for your kind help.

Usenet is hardly the place to go when you have urgent problems.  Still,
give

    % perl -pi.bak -e s/Employee/Faculty\/Student/g' file

a try.

Greg
-- 
The O-O languages give you more of course - prettier syntax, derived types and
so on - but conceptually they provide little extra.
    -- Rob Pike


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

Date: 02 Jul 1999 12:05:24 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: global substitution
Message-Id: <x7n1xf11h7.fsf@home.sysarch.com>

>>>>> "GB" == Greg Bacon <gbacon@itsc.uah.edu> writes:

  GB> In article <7limnc$f0e$1@nnrp1.deja.com>,
  GB> 	bing-du@tamu.edu writes:
  GB> : perl -ei 's/Employee/Faculty\/Student/g' myfile
  GB> :
  GB> : just did not work? Why?

  GB> Don't say "X didn't work".  Instead say what it did do and how that
  GB> was different from what you expected.

  GB> : It's quite urgent.  Thanks in advance for your kind help.

  GB> Usenet is hardly the place to go when you have urgent problems.  Still,
  GB> give

  GB>     % perl -pi.bak -e s/Employee/Faculty\/Student/g' file

sorry, greg, but you missed the open ' there. also depending on the
shell and quotes, the backwhack may not work so use an alternate
delimiter.

perl -pi.bak -e 's|Employee|Faculty/Student|g' file

as for the original problem, the -e option takes the next argument
(which could follow the e immediately) as the code. in general, a -e
option is the last in a group of options or it is isolated.

BTW, thanx for tossing the bee at yapc.

uri


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


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

Date: 2 Jul 1999 18:32:13 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: global substitution
Message-Id: <7lj0jd$c4n$2@info2.uah.edu>

In article <x7n1xf11h7.fsf@home.sysarch.com>,
	Uri Guttman <uri@sysarch.com> writes:
: BTW, thanx for tossing the bee at yapc.

Did this happen after hours?  If so, I reserve the right to deny that
it ever happened. :-)  I'm not sure what you're talking about, though.

Greg
-- 
It has been discovered that C++ provides a remarkable facility for concealing
the trival details of a program--such as where its bugs are. 
    -- David Keppel


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

Date: 2 Jul 1999 19:12:36 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: global substitution
Message-Id: <slrn7nqlb3.31h.abigail@alexandra.delanet.com>

bing-du@tamu.edu (bing-du@tamu.edu) wrote on MMCXXXI September MCMXCIII
in <URL:news:7limnc$f0e$1@nnrp1.deja.com>:
{} 
{} It's quite urgent.


It can't be urgent. It really can't. It must have a very low priority.

Otherwise, you would have taken half a minute and read up on -e and -i
in the manual. But nooooo, you had to drag yourself to Usenet, and you
can afford the time it takes before a reply comes. If at all.


Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


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


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

Date: Fri, 2 Jul 1999 07:00:52 -0400
From: "Doug Crabtree" <not@gonna.tell>
Subject: Hash problem...
Message-Id: <7li67f$3o3$1@nntp1.atl.mindspring.net>

I have a MLDBM file that has a "autonumber" key.

Let's say I have a file of three data records with the keys 1,2,3.

If I delete datarecord #2 then I am left with 1,3 after packing the file.

I am trying to have a function that will return the next key.  If I use
keys(%hash) then I will just write over #3 because there are only two keys
now.

My question is, is there a way I can go through the %hash and compare the
main keys?  Or what is the best way to figure out that the next key would be
#4?

TIA,
Doug




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

Date: Thu, 1 Jul 1999 06:10:49 -0700
From: "Dodger" <dodger@dodger.org>
Subject: Re: Hash problem...
Message-Id: <7libud$5g9$1@ancalagon.dragon-net.net>

Doug Crabtree wrote in message <7li67f$3o3$1@nntp1.atl.mindspring.net>...

>I am trying to have a function that will return the next key.  If I use
>keys(%hash) then I will just write over #3 because there are only two keys
>now.
>
>My question is, is there a way I can go through the %hash and compare the
>main keys?  Or what is the best way to figure out that the next key would
be
>#4?


Well, you could do something like:

$nextkey = (sort keys %hash)[-1];
$nextkey++;
$hash{$nextkey} = $nextvalue;

Is that what you mean? or do you want to fill in the missing $hash{2}?
If that's the case, you could trysomething like this to fill in the first
nonexistant key:

@keys = sort keys %hash;
for (@keys) {
    unless (exists $hash{$_}) {
        $hash{$_} = $newvalue;
        last;}}

if you are merely undeffing the value instead of deleting, just replace the
word 'exists' in the above example with 'defined' to fill in the first
undefined key, existant or not. If you want to fill in the first key defined
as 0, not defined, or not existant, remove 'exists' altogether. Play with
the unless for different variations, like ((exists $hash{$_}) and !(defined
$hash{$_})) to fill in the first key that exists but is not defined.

Dodger




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

Date: Fri, 2 Jul 1999 09:24:11 -0400
From: "Doug Crabtree" <Not@gonna.tell>
Subject: Re: Hash problem...
Message-Id: <7liep2$6t7$1@nntp3.atl.mindspring.net>


Dodger <dodger@dodger.org> wrote in message
news:7libud$5g9$1@ancalagon.dragon-net.net...
> Well, you could do something like:
>
> $nextkey = (sort keys %hash)[-1];
> $nextkey++;
> $hash{$nextkey} = $nextvalue;

That was what I needed.  I forgot to use the [-1] so I always got 2 instead
of 4.

Thanks again for your help!
Doug




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

Date: Fri, 02 Jul 1999 08:02:41 -0700
From: Andy Cantrell <cantrela@agcs.com>
To: Jun Zhuang <jzhuang@ringer.cs.utsa.edu>
Subject: Re: Help for Process
Message-Id: <377CD491.EF8B2B93@agcs.com>

Jun Zhuang wrote:
> 
> There is getppid function in perl to get parent PID.
>  If I want to get my PID(but no getpid in perl),
>  how would I do it?
> Thanks in advance.

 $$

-- 
Andy Cantrell  - cantrela@agcs.com
AG Communication Systems
Office (AZ) (623) 582-7495 (Voice mail)
Office (WI) (414) 249-0215
Modem  (WI) (414) 249-0239


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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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 V9 Issue 9
***********************************


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