[22823] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5044 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 27 03:05:54 2003

Date: Tue, 27 May 2003 00:05:09 -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           Tue, 27 May 2003     Volume: 10 Number: 5044

Today's topics:
    Re: a Bayesian intelligent e-mail autoresponder? <yeff@myrealbox.com>
    Re: a Bayesian intelligent e-mail autoresponder? (Thomas Raffill)
    Re: An error in my solution code (Steven Danna)
    Re: An error in my solution code (Tad McClellan)
    Re: Design Opinions - Dealing with Constants <REMOVEsdnCAPS@comcast.net>
    Re: Design Opinions - Dealing with Constants (Tad McClellan)
        Display form data in a html format. (Steve)
        DMake (newbie) <daniel_newhouse@earthlink.net>
    Re: does this make sence ? (about undef error on select <troc@netrus.net>
    Re: does this make sence ? (about undef error on select <webmaster@neverseenbefore.com>
        extracting records in an array <abhinospam@kizna.com>
    Re: extracting records in an array <bernard.el-hagin@DODGE_THISlido-tech.net>
    Re: extracting records in an array (Philip Lees)
        Game updated <mail@annuna.com>
    Re: How to get picture file in web which involve redire <willis_31_40@yahoo.com>
    Re: Lookahead: find empty line(s) or $ <MartinSchweikert@gmx.de>
    Re: Paths relative to a module <ben.goldberg@hotpop.com>
    Re: Perl 5.6.1 and Oracle 8.1.7 (Ron Reidy)
    Re: Perl on Mac OSX <bwalton@rochester.rr.com>
    Re: Perl on Mac OSX (Tad McClellan)
    Re: Perl on Mac OSX <ericw@nospam.ku.edu>
        Simple pattern matching question. <mail@annuna.com>
    Re: Simple pattern matching question. <bernard.el-hagin@DODGE_THISlido-tech.net>
    Re: Simple pattern matching question. <mail@annuna.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 27 May 2003 03:09:45 GMT
From: Yeff <yeff@myrealbox.com>
Subject: Re: a Bayesian intelligent e-mail autoresponder?
Message-Id: <ihkhynufqbth.dlg@lemming_militia.com>

On 26 May 2003 07:03:56 -0700, totojepast wrote:

> Please can you tell me if anybody has tried to use ifile or a similar
> Bayesian for an automatic e-mail autoresponder?

If I grok what you're trying to do (automatically identify and bounce 
spam?) then all I can say is that the concept is *evil*.

"Evil, pure and simple from the eighth dimension!"

You're doubling the amount of traffic generated by the spam and probably 
bouncing your messages to bogus addresses (not the people who actually sent 
the spam).

Evil.

-Jeff B.
yeff at erols dot com


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

Date: 26 May 2003 22:59:22 -0800
From: raff@cse.ucsc.edu (Thomas Raffill)
Subject: Re: a Bayesian intelligent e-mail autoresponder?
Message-Id: <3ed2feba$1@news.ucsc.edu>

>> Please can you tell me if anybody has tried to use ifile or a similar
>> Bayesian for an automatic e-mail autoresponder?
>
>If I grok what you're trying to do (automatically identify and bounce 
>spam?) then all I can say is that the concept is *evil*.

Before you think badly of the poster, here is another explanation. 

As far as I understand, an email autoresponder is a script on a web site
that automatically sends email to a person who has filled out a form on
the site. The form could be a request for further information, etc. 

Also, ifile is a machine learning program for classifying text. Its 
original intended application is to classify text as spam or not spam.

So to combine the two ideas, you would do machine learning on the
contents of filled out forms with the intended application of 
automatically classifying them to select the right email to send 
(i.e. is it a request for information about the XYZ product, or is it 
a complaint, etc.)

This sounds like a scripting issue and not really a big natural
language processing project. So the poster probably just wanted
to know whether or not the script for this already exists before
he goes out and does it himself.

So, I don't think the poster necessarily has an evil concept. 
Unfortunately, I don't know the answer to the original question ;-)

T. Raffill


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

Date: 26 May 2003 18:25:07 -0700
From: MissingWords@hotmail.com (Steven Danna)
Subject: Re: An error in my solution code
Message-Id: <e78d8c5a.0305261725.621c895c@posting.google.com>

Sorry, I did not know that changing the topic would create a new post.
 This post refers to the thread about the average calculation script.


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

Date: Mon, 26 May 2003 18:08:38 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: An error in my solution code
Message-Id: <slrnbd57jm.23i.tadmc@magna.augustmail.com>

Steven Danna <MissingWords@hotmail.com> wrote:

>   my @temp_numbers = split;
>   push @numbers, @temp_numbers;


You do not need the temporary variable:

   push @numbers, split;


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 26 May 2003 21:38:13 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Design Opinions - Dealing with Constants
Message-Id: <Xns9387E5F8E9FB9sdn.comcast@216.166.71.239>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

(posted to comp.lang.perl.misc and emailed to Kevin Vaughn)


"Kevin Vaughn" <kevin.vaughn@ttu.edu> wrote in
news:vbfemoj1e9hba1@corp.supernews.com: 

> I've created a large number of scripts that reference a single
file
> containing all of my constants.  I named the file environment.pl. 
The
> file mainly contains paths.  I include environment.pl using a
> "required" statement.
> 
> Is this good or bad design?  I'm particularly interested in the
> downsides. 
> 
> Now a specific question - How do I get perl to stop giving me the
> error "Global symbol $constant_from_environment requires explicit
> package name at $line_number" when I have strict turned on?
> 
> I'm trying to get my head around the lexical vs. package scope
thing,
> but it's not coming easy for some reason.  Do I have to go through
> creating a package, or can I use "our"?

This is a problem I have struggled with in the past, and which I've
seen other programmers struggle with.  I have given the issue some
thought, and I think I've come up with a decent solution.

The result is the Config::Vars module which I just uploaded to CPAN.
Let me know what you think.

Thanks,
- -- 
Eric
$_ =  reverse sort qw p ekca lre Js reh ts
p, $/.r, map $_.$", qw e p h tona e; print
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32) - WinPT 0.5.13

iD8DBQE+0s8WY96i4h5M0egRAsFaAJ9lYmbxUTPodlCpQvoBHUC1lGkIOwCgmIAl
PJyyjw/8+PRKgcc4yzaODxo=
=wbTl
-----END PGP SIGNATURE-----


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

Date: Mon, 26 May 2003 22:11:24 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Design Opinions - Dealing with Constants
Message-Id: <slrnbd5lqs.1nu.tadmc@magna.augustmail.com>

Kevin Vaughn <kevin.vaughn@ttu.edu> wrote:

> I've created a large number of scripts that reference a single file
> containing all of my constants. 


> Now a specific question - How do I get perl to stop giving me the error
> "Global symbol $constant_from_environment requires explicit package name at
> $line_number" when I have strict turned on?


   our $constant_from_environment;


> I'm trying to get my head around the lexical vs. package scope thing, but
> it's not coming easy for some reason.  


Have you seen MJD's article about it yet?

   "Coping with Scoping":

      http://perl.plover.com/FAQs/Namespaces.html


> Do I have to go through creating a
> package, or can I use "our"?


You can use our().

You need to use our() in each lexical scope where you want to
refer to the variables by their "short names".

So, in your case, you need an our() in the main program that
requires the constants file, which kind of defeats the purpose,
I expect.

It is often best to avoid the whole thing by using 
Your Very Own Symbol Table, also known as a "hash".  :-)


   # in the included file

   $c{var1} = 'value1';  # populate the config vars
   $c{var2} = 'value2';
   $c{var3} = 'value3';
   ...
   1;


   # in the including file (main?)

   require 'const.pl';
   our %c;
   ...
   if ( $c{var2} )
      { print "var2 was a true value\n" }

You have to type 3 more characters for each variable reference,
but in return you get your own (rather than built-in to perl)
data structure to do with what you please.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 26 May 2003 20:50:15 -0700
From: techadmin@shaw.ca (Steve)
Subject: Display form data in a html format.
Message-Id: <2e27f51a.0305261950.1b083a87@posting.google.com>

I have a web page, an html form, which when I receive in my e-mail
client is all text, in fact all the fileds are displyed not just the
ones filled. I would like to have the entire html page sent through
the email so when printed it will look exactly like the page that was
filled out. The forms, when first created worked perfectly, now that
we are using them and had to make a few changes, moved the filed from
a UNIX server to NT server, they do not e-mail the same way. I
remember the person who created tham saying that all they had to was "
encase them in 'Brackets'or 'Parenthases' or something of that nature
alhtough I am not sure what to put in brackets? I manot sure if they
meant the code in the forms.pl file or the code in the html file. can
anyone help.

Can anyome help


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

Date: Tue, 27 May 2003 05:13:06 GMT
From: "Daniel L Newhouse" <daniel_newhouse@earthlink.net>
Subject: DMake (newbie)
Message-Id: <CtCAa.17604$rO.1591608@newsread1.prod.itd.earthlink.net>

I want to build version 5.8.0 of Perl on Win98SE using Visual C++ 6.0 SP 5
and version 4.1 of dmake.  I also have version 5.5 of the command line
Borland C++ compiler on my computer.

My first question: Do I need to somehow run the patch file
"dmake-4.1pl1-win32.patch" to update dmake.exe first?  If so, how do I do
that?  I tried performing step one in the instructions at the beginning of
the patch file and received "Bad command or file name."

Generally speaking, the documentation that comes with DMake is rather
out of date.




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

Date: Tue, 27 May 2003 03:34:15 -0000
From: Rocco Caputo <troc@netrus.net>
Subject: Re: does this make sence ? (about undef error on select)
Message-Id: <slrnbd5n5i.1hhb.troc@eyrie.homenet>

[Followups directed to comp.lang.perl.misc.]

On Mon, 26 May 2003 07:10:55 +0200, Dieter D'Hoker wrote:
> I'm running a perl game server ,
> but I keep getting this shutdown error every few days :
> 
> Can't use an undefined value as a symbol reference at
> /usr/libdata/perl/5.00503/mach/IO/Select.pm line 57.
> ( $@ and $! are empty in my Sig DIE_ )
> 
> I guess this is because  in  "my @ready =
> IO::Select->select($Misc{readable}, $Misc{writable}, undef, SELECTINTERVAL);
> "
> selects gets an undef (that's in $Misc{readable}or $Misc{writable}) .
> I tried checking everything else when i adding a file handle checking if
> it's undef :
> 
>  if (defined $new and ($new ne undef) ) {
>           $Misc{readable}->add($new);"
> }
> 
> etc. etc.

[...]

> so I thought , is there a way to check if there is a way to check all
> handles if they are undef or not before using the select call ,
> so I came up with this , but I don't know if it makes any sence or will just
> slow down my server (ping is very important on a gameserver ) :
> 
>     my @readhandles = $Misc{readable}->handles;
>     my @writehandles = $Misc{writable}->handles;

[...]

  foreach ($Misc{readable}->handles) {
    next if defined;
    warn "readable has an undef handle";
    $Misc{readable}->remove($_);
  }

  foreach ($Misc{writable}->handles) {
    next if defined;
    warn "writable has an undef handle";
    $Misc{writable}->remove($_);
  }

The warn() calls give you more information about the problem so you can
debug it further.  For example, it will tell you whether the problem is
in your readable, writable, or both select vectors.  It'll also give you
some indication of how often the problem occurs.

Working around the problem should be a temporary measure until you can
figure out enough about the problem to correct it.  Especially such an
expensive workaround as this one.  It'll definitely slow down your game.

> The shell I'm running the server on still uses version 5.005_03 (freebsd) ,
> maybe it's a "bug" in that old version of perl ?

One way to find out for sure is to upgrade Perl.  That can be a lot of
work depending on what else relies on 5.5.3's particular quirks.  It may
be easier to track down the problem with old-fashioned debugging.  Good
luck!

-- Rocco Caputo - troc@pobox.com - http://poe.perl.org/


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

Date: Tue, 27 May 2003 08:45:05 +0200
From: "Dieter D'Hoker" <webmaster@neverseenbefore.com>
Subject: Re: does this make sence ? (about undef error on select)
Message-Id: <bav1ir$3guoj$1@ID-155251.news.dfncis.de>

"Rocco Caputo" <troc@netrus.net> wrote in message
news:slrnbd5n5i.1hhb.troc@eyrie.homenet...

 [...]

>   foreach ($Misc{readable}->handles) {
>     next if defined;
>     warn "readable has an undef handle";
>     $Misc{readable}->remove($_);
>   }
>
>   foreach ($Misc{writable}->handles) {
>     next if defined;
>     warn "writable has an undef handle";
>     $Misc{writable}->remove($_);
>   }
>
> The warn() calls give you more information about the problem so you can
> debug it further.  For example, it will tell you whether the problem is
> in your readable, writable, or both select vectors.  It'll also give you
> some indication of how often the problem occurs.
>
> Working around the problem should be a temporary measure until you can
> figure out enough about the problem to correct it.  Especially such an
> expensive workaround as this one.  It'll definitely slow down your game.
>
> > The shell I'm running the server on still uses version 5.005_03
(freebsd) ,
> > maybe it's a "bug" in that old version of perl ?
>
> One way to find out for sure is to upgrade Perl.  That can be a lot of
> work depending on what else relies on 5.5.3's particular quirks.  It may
> be easier to track down the problem with old-fashioned debugging.  Good
> luck!


Thanks for the help !


-- 
Dieter D'Hoker
http://dieter.dhoker.com/
news:free.nl.dieter.dhoker & news:alt.nl.fan.dieter.dhoker
Tetrinet SeRVer : TSRV.COM




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

Date: Tue, 27 May 2003 14:29:40 +0900
From: "Abhi" <abhinospam@kizna.com>
Subject: extracting records in an array
Message-Id: <baut5t$3sl4b$1@ID-147252.news.dfncis.de>

I need to extract records from a log file, that look like the below sample.

The idea is to extract the range of lines between the patterns REQUEST DATA
and END OF REQUEST DATA as a single array element, and repeat for the next
record, so that in the end, I can parse and generate a summary of hits per
hour, per user-agent.

print if m#REQUEST DATA#i .. m#END OF REQUEST DATA#i' does this ofcourse.
How can I extract the records into an array ?


***                 REQUEST DATA                              ***
*****************************************************************
*****************************************************************
 *****************************
 *       DateTimeData        *
 *****************************
  Arrival Date : 9-Dec-2002
  Arrival Time : 3:38:13:1
 *****************************
 *    End of DateTimeData    *
 *****************************

 *****************************
 *       RequestHeaders      *
 *****************************
  user-agent : Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Win 9x 4.90)
  cache-control : max-age=259200
 *****************************
 *   End of RequestHeaders   *
 *****************************
*****************************************************************
*****************************************************************
***                 END OF REQUEST DATA                       ***


Thanks in advance,
Abhi



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

Date: Tue, 27 May 2003 06:10:09 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: extracting records in an array
Message-Id: <Xns938852B99B2F5elhber1lidotechnet@62.89.127.66>

Abhi wrote:

> I need to extract records from a log file, that look like the below
> sample. 
> 
> The idea is to extract the range of lines between the patterns REQUEST
> DATA and END OF REQUEST DATA as a single array element, and repeat for
> the next record, so that in the end, I can parse and generate a
> summary of hits per hour, per user-agent.
> 
> print if m#REQUEST DATA#i .. m#END OF REQUEST DATA#i' does this
> ofcourse. How can I extract the records into an array ?


while (<LOG>) {
  push @array, $_ if /REQUEST DATA/i .. /END OF REQUEST DATA/i;
}


-- 
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'



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

Date: Tue, 27 May 2003 06:25:04 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: extracting records in an array
Message-Id: <3ed30457.61128109@news.grnet.gr>

On Tue, 27 May 2003 14:29:40 +0900, "Abhi" <abhinospam@kizna.com>
wrote:

>I need to extract records from a log file, that look like the below sample.
>
>The idea is to extract the range of lines between the patterns REQUEST DATA
>and END OF REQUEST DATA as a single array element, and repeat for the next
>record, so that in the end, I can parse and generate a summary of hits per
>hour, per user-agent.
>
>print if m#REQUEST DATA#i .. m#END OF REQUEST DATA#i' does this ofcourse.
>How can I extract the records into an array ?

If I understand you correctly, you just need to replace the 'print if'
with 'push @array, $_ if'.

Phil
-- 
Ignore coming events if you wish to send me e-mail


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

Date: Tue, 27 May 2003 01:59:37 -0500
From: Joe Creaney <mail@annuna.com>
Subject: Game updated
Message-Id: <3ED30CD9.8070803@annuna.com>

I got my game working better thanks to all the help I got here.
www.annuna.com/perl5



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

Date: Tue, 27 May 2003 02:21:32 GMT
From: w i l l <willis_31_40@yahoo.com>
Subject: Re: How to get picture file in web which involve redirection  using LWP
Message-Id: <gui5dv8k7ak9cjr0hk404osg43t2vtmgu5@4ax.com>

On 25 May 2003 11:23:18 -0700, alam@netscape.com (Antonio Lam) wrote:

>I tried to get some images from the web using LWP, and find out some
>sites won't allow me to do it directly with absolute URL address (eg.
>http://www.hostname.com/dir/pic.jpg). Even from the browser, if I type
>the absolute URL address, it will redirect me to other page insted
>retrieve the image. So I need to go to their main page (eg.
>http://www.hostname.com) and click its link within the page to
>retrieve the image. I think there are some sort of file protection in
>the site which force the user to navigate through their pages to get
>those files.
>
>So if I do the following code in Perl:
>
>---------------------
>use LWP::Simple;
>
>if (is_success($rtrcode =
>getstore("http://www.hostname.com/dir/pic.jpg", "pic.jpg"))) {
>  print "Got file.\n";             
>} else {
>  print "Can not find file\n";
>}
>print "rtrcode is: $rtrcode\n";
>----------------------
>
>the return code still '200' but i am not getting the right file.
>(instead, it is a redirected index file).
>
>Any idea on how to solve this problem?
>
>Thanks,
>Antonio.


what's the domain? let me try.

 w i l l


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

Date: 27 May 2003 06:37:48 GMT
From: Martin Schweikert <MartinSchweikert@gmx.de>
Subject: Re: Lookahead: find empty line(s) or $
Message-Id: <Xns938857CA4AF87MartinSchweikertgmxd@130.133.1.4>

Hi all!

Thank you for your help!

Gruss,
Martin
-- 
http://www.martin-schweikert.de


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

Date: Mon, 26 May 2003 22:54:35 -0400
From: Benjamin Goldberg <ben.goldberg@hotpop.com>
Subject: Re: Paths relative to a module
Message-Id: <3ED2D36B.5E6521@hotpop.com>

emcee wrote:
> 
> Benjamin Goldberg wrote:
[snip]
> > Then it's a good thing that File::Spec is a standard module, isn't
> > it?
> 
> Well, I read through the pod on File::Spec and came up with this:
> 
> $_=File::Spec->rel2abs($INC{'testinc.pm'});

Well, that's good.

> s/testinc\.pm$//;

That's not so good.  There's *no* requirement that removing the name of
the filename from the end of a filepath produce a valid directory name.

For example, IIRC, on VMS, a filepath might look something like
"foo:[.bar.baz.quux]testinc.pm", and removing just the "testinc.pm" part
from the end would produce "foo:[.bar.baz.quux]", which is invalid... a
valid directory path would be "foo:[.bar.baz.]quux.dir" ... or something
like that.  If you want to get the pathname, and remove the filename,
then you should use File::Spec->splitpath.

> It works but, there seems to be a different version of this method for
> each OS,

It should!  Different operating systems generally come with different
filesystems!

Obviously you need a different of the code for each OS.

> so I'm not sure if it will work for all operating systems.

If you tried to use the *same* code for every OS, then it certainly
wouldn't work for *all* operating systems.  It would only work on those
OS's which have a filesystem similar to the one for which you wrote the
code.

By having different code for each Os, File::Spec manages to get it right
for whichever Os it's being used on.

> I'll likely end up using File::Spec, but I would like to find a
> simpler answer, one that doesn't require loading a seperate module.

Why do you want to avoid loading a seperate module?

> When the problem first first came up, my first though was to use %INC
> because I remembered using it in the past for this same type of
> problem, when it didn't work, I thought it was because of use lib, but
> even with out that I seem to have the same problem. The only other
> thing that's changed it that I switched from Perl 5.6 to 5.8, but I
> doubt that's it.

-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}


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

Date: 26 May 2003 21:04:50 -0700
From: reidyre@yahoo.com (Ron Reidy)
Subject: Re: Perl 5.6.1 and Oracle 8.1.7
Message-Id: <ab425431.0305262004.2bc3a447@posting.google.com>

You could use DBI::Proxy.  Better to install the Oracle
client...forget copying files, not a supported option.

--
Ron Reidy
Oracle DBA

twronapl@yahoo.com (Tomasz) wrote in message news:<5979bec2.0305260804.7a04f8b1@posting.google.com>...
> Hello,
> 
> I've got a perl 5.6.1. I would like to connect to Oracle Database
> 8.1.7 on the remote machine, without installing Oracle Client on my
> machine. I've installed DBI package, but there are problems with
> DBD-Oracle - installation cannot find the ORACLE_HOME structure. I've
> copied some folders to my machine (network, rdbms, lib) and it worked
> till 'make test'. How can I connect with the remote machine?
> 
> Thanks a lot for any help
> 
> Tomasz Wrona


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

Date: Tue, 27 May 2003 01:05:44 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Perl on Mac OSX
Message-Id: <3ED2B90D.70107@rochester.rr.com>

Alfonso G. Urroz wrote:

> Hi there, I am trying to learn PERL on my own, using the Terminal feature
> available on Mac OSX. I am using the famous "Camel Book", and nothing


You probably want the "Llama" book, "Learning Perl".  The "Camel" book 
is a reference document, and is not well-suited for Perl newbies.


> seems to work.
> 
> First I tried the following:
> time > script1
> date >> script1
> 


Do you perhaps mean:

echo time > script1
echo date > script1

?


> Then I typed:
> cat script1
> 
> The system answered:
> time
> date
> as expected
> 


It would appear that you are attempting to make a shell script, rather 
than a Perl program?  And maybe a shell script for Windoze or DOS? 
'time' is a Perl function, but 'date' is not.  'time' by itself in Perl 
would not appear to do anything, and further, the lack of a statement 
separator (;) between Perl statements is a syntax error.


> Then I typed:
> chmod +x script1
> 
> Then I typed:
> script1
> 
> The system answered:
> scriptq is not a command, or something like that.
 ...


> Alfonso G. Urroz
 ...

First, I don't know much about Mac OS X, except that it is some flavor 
of Unix, or at least based on that.  As such, a Perl executable script 
(or any other executable script, such as a shell script) needs to start 
with a "shebang" line, something like:

#!/path/to/Perl/interpreter/perl -w

as the very first line.  You'll have to figure out where your Perl 
interpreter resides and substitute that in the above.  Try the script:

#!/path/to/Perl/interpreter/perl -w
print "Hello, world\n";

and see if that will run and print Hello, world.  If it will, then 
you're all set.

I would advise finding and using a decent text editor rather than using 
the console for program input.  Maybe vi or something is available?

-- 
Bob Walton



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

Date: Mon, 26 May 2003 22:19:02 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl on Mac OSX
Message-Id: <slrnbd5m96.1nu.tadmc@magna.augustmail.com>

Bob Walton <bwalton@rochester.rr.com> wrote:


> First, I don't know much about Mac OS X, 


Me either.


> except that it is some flavor 
> of Unix, or at least based on that.  As such, a Perl executable script 
> (or any other executable script, such as a shell script) needs to start 
                                                           ^^^^^^^^
> with a "shebang" line, something like:
> 
> #!/path/to/Perl/interpreter/perl -w


It _can_ start with a shebang line, but it does not _need to_ in
order to be run. You only need a shebang if you are going to
make use of the shebang (which _is_ the most common way of 
running scripts, I'll admit).

Try it the easy way before bothering with sorting out what the
proper shebang is:

   perl my_program

(assuming perl is in the command path)


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 27 May 2003 04:11:00 GMT
From: Eric Wilhelm <ericw@nospam.ku.edu>
Subject: Re: Perl on Mac OSX
Message-Id: <pan.2003.05.26.23.07.51.890976.32388@nospam.ku.edu>

On Mon, 26 May 2003 18:36:11 -0500, Alfonso G. Urroz wrote:

> Then I typed:
> chmod +x script1
> 
> Then I typed:
> script1
> 
> The system answered:
> scriptq is not a command, or something like that.

This is because it is not in your path.

To execute a file in the current directory:  ./file (provided that it is
executable)

To add a directory to your path, see if you have a ~/.bash_profile or
something with a PATH= line in it.

If you make yourself a ~/bin/ directory, and save all of your scripts in
there after adding it to your path, you will be able to call them from
anywhere with:  "scriptname ARGS", otherwise you will always have to use
an absolute (/home/you/dir/script or ~/dir/script) or relative (./script 
 ../script) path to get to them.

--Eric


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

Date: Tue, 27 May 2003 00:45:36 -0500
From: Joe Creaney <mail@annuna.com>
Subject: Simple pattern matching question.
Message-Id: <3ED2FB80.7000404@annuna.com>

Simply how do I write if ($x contains "text") { ?



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

Date: Tue, 27 May 2003 06:05:46 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: Simple pattern matching question.
Message-Id: <Xns938851FBAAD73elhber1lidotechnet@62.89.127.66>

Joe Creaney wrote:

> Simply how do I write if ($x contains "text") { ?


if ($x =~ /text/) { }


For more information:


 perldoc perlretut
 perldoc perlop
 perldoc perlre


-- 
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'



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

Date: Tue, 27 May 2003 01:18:11 -0500
From: Joe Creaney <mail@annuna.com>
Subject: Re: Simple pattern matching question.
Message-Id: <3ED30323.2010709@annuna.com>



Bernard El-Hagin wrote:
> Joe Creaney wrote:
> 
> 
>>Simply how do I write if ($x contains "text") { ?
> 
> 
> 
> if ($x =~ /text/) { }
> 
> 
> For more information:
> 
> 
>  perldoc perlretut
>  perldoc perlop
>  perldoc perlre
> 
> 
Thanks that was too easy I got confused skimming though the book and 
seeing different examples.




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

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


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