[11047] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4647 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 14 02:03:11 1999

Date: Wed, 13 Jan 99 23:00:19 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 13 Jan 1999     Volume: 8 Number: 4647

Today's topics:
    Re: @ARGV and $_ Question <uri@home.sysarch.com>
    Re: @ARGV and $_ Question <roclimb@yahoo.com>
    Re: __DATA__ <eugene@snailgem.org>
    Re: A really easy string question (Ronald J Kimball)
    Re: A really easy string question (Ronald J Kimball)
    Re: Can I use perl with https? <morrowc@his.com>
    Re: Capturing output from a program in PERL (Tad McClellan)
    Re: cgi/perl fuming meltdown (Ronald J Kimball)
    Re: Creating an htaccess file - how do I supply program (Derk Voss)
    Re: cut (I R A Aggie)
    Re: determine, if file is directory (Abigail)
    Re: File searching (Tad McClellan)
        max. length of perl regexp s_jagadish@yahoo.com
        Need help with cookies <alex@digi-q.com>
    Re: Need help with cookies (brian d foy)
    Re: Parsing the name from a form field name=Smith (Ronald J Kimball)
        pattern matching <dragann@sprint.ca>
    Re: pattern matching (Tad McClellan)
    Re: Perl Criticism (I R A Aggie)
    Re: Perl Criticism (I R A Aggie)
        problem with 'eval "use $module_name ..."' <arolfe@mit.edu>
    Re: Removing Blank lines (Tad McClellan)
        Running Perl scripts for Macs <jasongadde@home.com>
    Re: Running Perl scripts for Macs (brian d foy)
    Re: Sending SMS messages with perl script ?? tomten@my-dejanews.com
    Re: Simple regexp (I think =b) (Tad McClellan)
        Syntax help wanted:  "use strict" and sort $a and $b pa (William Herrera)
    Re: where can I get perlfunc.pod (Abigail)
    Re: Why doesn't it work? rga@io.com
    Re: Yet another REGEX question (Ronald J Kimball)
    Re: Yet another REGEX question (John Moreno)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 13 Jan 1999 23:08:21 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: @ARGV and $_ Question
Message-Id: <x7hftuh4y2.fsf@home.sysarch.com>

>>>>> "RM" == Rafiq Mateen <rafiqmateen@netscape.net> writes:

  RM> This is a multi-part message in MIME format.
  RM> --------------F92FC23E7359E0AEDAA50A97
  RM> Content-Type: text/plain; charset=us-ascii
  RM> Content-Transfer-Encoding: 7bit

don't post with mime. usenet is a text only medium.

  RM> I will answer the $_ answer for you and hopefully I make sense.

  RM> foreach $i(@one){        }

$_ has many more uses than just the iterator of foreach loops

  RM> for($i = 0; $i <= $#one; $i++) {       }

this is c code. in perl it is

foreach $i ( 0 .. $#one ) {}

  RM> I learned using this step is faster:

have you benchmarked it?

  RM> 	$total = $total + $_;	Now the $_ contains the first value in @one

$total += $_ ;

is neater and probably faster (fewer perl ops but unbenchmarked)

  RM> 	print;	
  RM> 	# or

  RM> 	print  "\n";

that will just print a blank line. only a naked print uses $_ by default.

  RM> begin:vcard 
  RM> end:vcard

and there is no need for vcard, EVER. the mail headers and signature
cover all that crap.

hth,

uri

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


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

Date: Thu, 14 Jan 1999 00:16:13 -0500
From: "Brad" <roclimb@yahoo.com>
Subject: Re: @ARGV and $_ Question
Message-Id: <77juan$8ag$1@news.monad.net>

That was incredible help...Thank you so much for answering my question! I
never thought of reading the documentation...how stupid of me?!

Don't you think I read the documentation and still didn't quite understand?
Or are you just some kind of a smart-ass? If you aren't going to be of any
help just stay out of newsgroups. You aren't helping me or anyone else who
might have the same question or having the same problem.

You must be some kind of expert and if that is the case maybe you should be
writing the documentation or spending your time more wisely by writing code.

Maybe to feel good about yourself by putting other people down or by stating
the obvious. I wish you many years of good fortune.

Once again, cheers Andre, your the best.

Brad



Andre L. wrote in message ...
>In article <77j8bf$kgg$1@news.monad.net>, "Brad" <roclimb@yahoo.com> wrote:
>
>> Could someone give me a good definition of these two items and a couple
good
>> examples? Or point me in the direction where I can find good definition
and
>> examples.
>
>How about... the documentation? :)
>
>Andre




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

Date: Wed, 13 Jan 1999 23:03:56 -0500
From: Eugene Sotirescu <eugene@snailgem.org>
Subject: Re: __DATA__
Message-Id: <369D6CAC.D3C68AA5@snailgem.org>

Ahem . . .

#!/usr/local/bin/perl -w
use diagnostics;

while (<DATA>) {
   @words = split (/\W+/);
   @words < 9 ? print "@words\n" : print "@words[0..9]\n";
}

__END__
The DVA XPress Plus allows a PC-based system to switch, control, digitize,
store, record, and play back
 video. It also protects the investment into previous systems by using most of
the existing cameras, ca
bles, and monitors.
The product accepts video from up to eight cameras (color or monochrome, NTCS,
or PAL), switches betwee
n the cameras quickly, and compresses the video images and records them to the
computer's hard drive or
 other digital storage media without rolling.



Eugene Sotirescu wrote:

> You'll mostly use the DATA filehandle (combined with the __END__   token): it
> lets you have the data in your program file (instead of reading it from a
> separate file). This comes in handy when you want to test out things, since  you
> can easily modify the input.
>
> This script, for ex., finds the first 10 words in each line of input:
>
> --------------------------
>
> #!/usr/local/bin/perl -w
> use diagnostics;
>
> while (<DATA>) {
>    @words = split (/\W/);
>    print "@words[0..9]\n";
> }
>
> __END__
> The DVA XPress Plus allows a PC-based system to switch, control, digitize,
> store, record, and play back
>  video. It also protects the investment into previous systems by using most of
> the existing cameras, ca
> bles, and monitors.
> The product accepts video from up to eight cameras (color or monochrome, NTCS,
> or PAL), switches betwee
> n the cameras quickly, and compresses the video images and records them to the
> computer's hard drive or
>  other digital storage media without rolling.
>
> ------------------------------
>
> om7@cyberdude.com wrote:
>
> > Can someone please tell me where to find out more about __DATA__ and how and
> > when to use it.  I've tried looking in Programming Perl, but didn't find much
> > help there with regards to how and what to use it for and I don't have access
> > to the man pages.
> >
> > Thanks.
> >
> > -----------== Posted via Deja News, The Discussion Network ==----------
> > http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own



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

Date: Wed, 13 Jan 1999 23:28:40 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: A really easy string question
Message-Id: <1dlldio.6dfvue10fdy4oN@bay1-541.quincy.ziplink.net>

<kjer@my-dejanews.com> wrote:

> This is a good solution that split a string into path and filename:
> 
> $_=$pathname;
> m/^(.*)([^\/]*)$/;
> print "path is: '$1', filename is '$2'\n";

It would be a good solution, if it worked.

$pathname = "path/to/file";

gives the output

path is: '/path/to/file.txt', filename is ''

Your regex happily matches the entire string with (.*), leaving nothing
for ([^\/]*) to match.


Also:
Assigning to $_ first is unnecessary (learn how to use =~ instead), and
you shouldn't use $1 et al. unless you know the regex matched
successfully.

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


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

Date: Wed, 13 Jan 1999 23:28:41 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: A really easy string question
Message-Id: <1dlldrb.1fgbxauqasqrkN@bay1-541.quincy.ziplink.net>

<info@gadnet.com> wrote:

> I want to become "a perl stud" as dhosek@webley.com
> phrases it, and to use a regexp

Being a "Perl stud" does not mean using a regexp.  Being a Perl stud
means knowing when to use a regexp, and when to use a module.


I've seen too many "Perl studs" use regular expressions when there are
other ways to do it that are more efficient, more readable, and, in some
cases, actually correct.

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


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

Date: Thu, 14 Jan 1999 00:50:45 -0500
From: Chris Morrow <morrowc@his.com>
To: allen snook <circuit@seanet.com.nospam>
Subject: Re: Can I use perl with https?
Message-Id: <369D85B5.CF9C4504@his.com>

You rproblem is MOST LIKELY with the configuration of the Secure
Server... the Normal HTTP server is recognizing your cgi-bin directory,
the Secure server is NOT...

Easy fix would be to have the ISP add your CGI-BIN to the ScriptAlias
line of the secure server (ScriptAlias is a NCSA/APACHE thing... on NT
or NS it's a bit different syntax/naming)

-Chris

allen snook wrote:
> 
> Hi all,
> 
> I'm in the process of putting together a secure perl script, but I want the
> script to be run in an encrypted mode.  In my HTML that kicks off the
> script, I have a form call as follows:
> 
> <FORM ACTION="https://www.charm.net/~seattle/cgi-bin/ss.pl" METHOD=POST>
> 
> When I click on ye olde submit button, I get the following error
> 
> Method Not Allowed
> The requested method POST is not allowed for the URL /~seattle/cgi-bin/ss.pl
> 
> The permissions on the file are 755, of course.  If I replace the https with
> http, it works fine, but obviously it is no longer secure.
> 
> Is this a problem with my ISP, or perl?  My ISP hasn't answered my question
> yet.
> 
> Thanks
> 
> ...Allen
> circuit@seanet.com.nospam


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

Date: Wed, 13 Jan 1999 23:45:56 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Capturing output from a program in PERL
Message-Id: <ka0k77.ji7.ln@magna.metronet.com>

Michael J. Wrobel (mjw@hrb.com) wrote:
: What is the easiest way to capture output from a program in PERL?


   The easiest way would be to do a word search on the files
   that have already been installed on your hard drive...

      perl -ne 'print if /capture/' perlfaq8.pod

=head2 How can I capture STDERR from an external command?
To capture a command's STDERR and STDOUT together:
To capture a command's STDOUT but discard its STDERR:
To capture a command's STDERR but discard its STDOUT:
To exchange a command's STDOUT and STDERR in order to capture the STDERR


   Easier than typing up a Usenet article even...


: Thanks,

Right.


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


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

Date: Wed, 13 Jan 1999 23:28:42 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: cgi/perl fuming meltdown
Message-Id: <1dlle45.1q1vewp1ex5dhfN@bay1-541.quincy.ziplink.net>

Eric Bohlman <ebohlman@netcom.com> wrote:

> : $pick = rand(@mypic);
> : open (BANNER,$mypic[$pick]);
> 
> perldoc -f rand will tell you that rand() returns a random *fractional*
> value.  Fractional values don't make very good array indices.

Which is why Perl will silently truncate a floating point number when it
is used an index.  Even with warnings enabled.


#!/usr/local/bin/perl -w
@foo = (0..10);
print $foo[rand @foo], "\n";


So what's the problem?

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


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

Date: 13 Jan 1999 20:21:40 -0800
From: derk@sonic.net (Derk Voss)
Subject: Re: Creating an htaccess file - how do I supply program input?
Message-Id: <77jrck$shg@bolt.sonic.net>

Michael Stearns (michael@datahost.com) wrote:
: Hello:
: 
: I have a text file that looks like this:
: 
: user1,pass1
: user2,pass2
: user3,pass3
: 
: I would like to convert it to an htpasswd file.

Load your text file into @FOO
for(@FOO){chomp; ($N,$P)=split/,/; $P=crypt($P,XX); $_="$N:$P\n";}
print @FOO into your AuthUserFile
Derk


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

Date: Tue, 12 Jan 1999 15:12:36 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: cut
Message-Id: <fl_aggie-1201991512360001@aggie.coaps.fsu.edu>

In article <369B88C2.6796@cig.mot.com>, Gump <a14203@cig.mot.com> wrote:

[posted && cc'd]

+    Is there a function in perl which can do task just like
+ "cut" command in Unix?
+ for example, get third part ("1.2.0") from below string:
+ 
+ "KingSoftware   StarTest   1.2.0   01-01-1999"

You want to look at split:

$_="KingSoftware   StarTest   1.2.0   01-01-1999";
@res=split;
foreach $element (@res) {
   $count=$count+1;
   print "$element\t$count\n";
}

Results:

KingSoftware    1
StarTest        2
1.2.0   3
01-01-1999      4

James


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

Date: 14 Jan 1999 04:38:51 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: determine, if file is directory
Message-Id: <77jscr$hjh$1@client2.news.psi.net>

Patrick Clauberg (pat@uni.de) wrote on MCMLXII September MCMXCIII in
<URL:news:369d3cdb.31341568@129.217.240.1>:
?? Hi folks,
?? 
?? i would like to do a recursive search over a directory.

Then use File::Find.

?? Has readdir() a parameter to execute it recursively?
?? 
?? I would like to check every file in the direcory, and if any file is a
?? directory itself, I start the check function with the new path.

No you don't - you will never finish.

?? A Perl Book tells me: if (-d $filename) { ....
?? 
?? should work.

For suitable definitions of "work".

?? Another one is the stat function.
?? 
?? Both of them don't seem to work

How should we know? You should supply us with at least three critical
pieces of information:
   - What did you do?
   - What did you expect it to do?
   - What did it do?


?? how can it be?

Phases of the moon? High tide? Sun flares?




Abigail


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

Date: Thu, 14 Jan 1999 00:19:57 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: File searching
Message-Id: <da2k77.ji7.ln@magna.metronet.com>

Cybernetic Bear (cybear_x[nospam]@geocities.com) wrote:

: Is there a way to read a list of directory names into
: a perl script?


   opendir(DIR, $dir) || die "could not open '$dir' directory  $!";
   my(@dirs) = grep -d "$dir/$_", readdir(DIR);
   closedir(DIR);


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


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

Date: Thu, 14 Jan 1999 05:57:34 GMT
From: s_jagadish@yahoo.com
Subject: max. length of perl regexp
Message-Id: <77k10a$8pk$1@nnrp1.dejanews.com>

is there a limit on the max. length of a regexp ? if so what is it ?

thanks

jagadish
--
That's not bad code, I'm trying to confuse would be hackers.

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


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

Date: Wed, 13 Jan 1999 22:38:55 -0800
From: Alex Guberman <alex@digi-q.com>
Subject: Need help with cookies
Message-Id: <369D90FF.661B@digi-q.com>

Hi,

I was wondering what is wrong with my script that is suppose to send a
cookie if a person comes in for the first time and recognize that person
if s/he comes in for the second time:

if(! defined $ENV{'HTTP_COOKIE'})
{
  print "Content-type: text/html\n"; 
  print "Set-Cookie: Cook=Here; path=/cgi-bin/;
domain=rec-online.com\n\n";
  print "<HTML><BODY>Test Cookies Set</BODY></HTML>";
  
} else {

  print "Content-type: text/html\n\n";
  print "You've already got a cookie";
}

Thank you.


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

Date: Thu, 14 Jan 1999 01:53:08 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Need help with cookies
Message-Id: <comdog-ya02408000R1401990153080001@news.panix.com>

In article <369D90FF.661B@digi-q.com>, alex@digi-q.com posted:

> I was wondering what is wrong with my script that is suppose to send a
> cookie if a person comes in for the first time and recognize that person
> if s/he comes in for the second time:

>   print "Set-Cookie: Cook=Here; path=/cgi-bin/;
> domain=rec-online.com\n\n";

that doesn't look like a valid cookie.  see the cookie specification,
referenced in the CGI Meta FAQ, to see what you need to do -
specifically, the part on forming the domain value.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Wed, 13 Jan 1999 23:28:43 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Parsing the name from a form field name=Smith
Message-Id: <1dllere.1j4kx8tbxx9jbN@bay1-541.quincy.ziplink.net>

Ramanujam Parthasarathi <partha@mihy.mot.com> wrote:

> Hi,
> 
> Use pattern matches - maybe something like
> $post = "name=Smith";  # actually received from script
> $post =~ /name=.*/;
> $name = $1;
          ^^

This variable generally implies parentheses somewhere in the regular
expression.  Did you forget something?  :-)

And you shouldn't use $1 et al. unless the regular expression
successfully matched.


Try this instead:

($name) = $post =~ /name=(.*)/;

$name will be undefined if the regex didn't match.

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


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

Date: Thu, 14 Jan 1999 00:16:21 -0500
From: Dragan Nedeljkovic <dragann@sprint.ca>
Subject: pattern matching
Message-Id: <369D7DA5.3F4FAC5D@sprint.ca>


Hi all,

How I can test that file name starts with "STAT"
and ends with ".ERR".

Thanks,
     Dragan




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

Date: Wed, 13 Jan 1999 23:34:25 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: pattern matching
Message-Id: <1lvj77.ji7.ln@magna.metronet.com>

Dragan Nedeljkovic (dragann@sprint.ca) wrote:

: How I can test that file name starts with "STAT"
: and ends with ".ERR".


   /^STAT.*\.ERR$/;


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


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

Date: Tue, 12 Jan 1999 15:04:58 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl Criticism
Message-Id: <fl_aggie-1201991504580001@aggie.coaps.fsu.edu>

In article <8p6u2xwe4zx.fsf@Eng.Sun.COM>, Mike Coffin <mhc@Eng.Sun.COM> wrote:

+ Jerome O'Neil <jeromeo@atrieva.com> writes:
+ > I'll take that wager.  If you loose, you go away and never come back.
 
+ You lose;

Really? You should have passed this to the perl interpreter before being
so bold...

+   "@_(-->$/(.)/up/Your*$s\\|>you&%!$@#crypt=++||#@tol<>>??logists!@#";
+ 
+ is runnable.

Is not:

In string, @tol now must be written as \@tol at - line 1, near
"$@#crypt=++||#@tol"

Sorry.

James - details:

% perl -v

This is perl, version 5.004_04 built for irix

Copyright 1987-1997, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.


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

Date: Tue, 12 Jan 1999 15:09:13 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl Criticism
Message-Id: <fl_aggie-1201991509130001@aggie.coaps.fsu.edu>

In article <77g7p5$f1n$1@nnrp2.dejanews.com>, topmind@technologist.com wrote:

+ Perler's actually have
+ contests to see who can write and read the most cryptic code.
+ "Nerd Machoism" is what I call it.

So? this has what to do with writing maintainable code?

I know a guy...he took a course in Cyber assembly many years ago. The
students routinely had contests to determine who could write fastest code,
the smallest code, etc, for each assignment.

This was serious stuff, you see. Beer was on the line.

James


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

Date: 13 Jan 1999 20:59:00 -0500
From: Alex Rolfe <arolfe@mit.edu>
Subject: problem with 'eval "use $module_name ..."'
Message-Id: <ubzogo2haxn.fsf@m56-129-7.mit.edu>


I'm writing a forked server which needs to load 2 modules based on the
request.  I try to load the modules as follows :

eval "use $name qw ( ....)";

For one module, this works fine and it loads correctly.  For the other,
the eval fails and the error message is that there were too many errors
in the module (which loads fine if I hardcode in the name and don't use
eval.  hardcoding the name in the eval causes the error).  I can't
figure out why putting the "use" statement in an eval would cause the
module to suddenly have problems.  Any suggestions?

Thanks,
Alex Rolfe
arolfe@mit.edu


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

Date: Wed, 13 Jan 1999 23:52:19 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Removing Blank lines
Message-Id: <jm0k77.ji7.ln@magna.metronet.com>

Dale Bohl (dbohl@sgi.com) wrote:
: This is a multi-part message in MIME format.
                               ^^^^^^^^^^^^^^

   Please don't do that any more.

   Your "newsreader" is misconfigured. Fix it.


: How do I delete blanks lines from an array?


   perldoc -f splice

   although it is probably better to not put them into the
   array in the first place...


: Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
                                                      ^^^^^^^^^

   Please don't do that any more.

   Your "newsreader" is misconfigured. Fix it.



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


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

Date: Wed, 13 Jan 1999 21:37:23 GMT
From: Jason Gadde <jasongadde@home.com>
Subject: Running Perl scripts for Macs
Message-Id: <369D12CE.1FCE5F55@home.com>

I'm new to the wonderful world of Perl and have a few questions but I'll
only ask this one:

Does anyone know that if a script is able to run in a Windows
environment, can it also be run in a Mac environment? Is there any major
differences (ie. with Regular Expressions, special characters,
functions) in the actual scripts itself.

I assume that I will need to get MacPerl to interpret the script for the
Mac. I'm just wondering if I'm going to need to write two version of the
same app.

Thanks,
Jason



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

Date: Thu, 14 Jan 1999 01:49:10 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Running Perl scripts for Macs
Message-Id: <comdog-ya02408000R1401990149100001@news.panix.com>

In article <369D12CE.1FCE5F55@home.com>, jasongadde@home.com posted:

> Does anyone know that if a script is able to run in a Windows
> environment, can it also be run in a Mac environment? Is there any major
> differences (ie. with Regular Expressions, special characters,
> functions) in the actual scripts itself.

Perl is Perl.  if you do something non-Perl, then there might be a
problem.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Thu, 14 Jan 1999 05:18:17 GMT
From: tomten@my-dejanews.com
Subject: Re: Sending SMS messages with perl script ??
Message-Id: <77jumi$6ta$1@nnrp1.dejanews.com>

In article <77cthn$3gu$1@koza.nl.net>,
  "Peter Davidse" <ptrdvds@zeelandnet.nl> wrote:
> For a hobby project i need to send SMS messages from a linux based
> webserver. Does any one know how to send SMS messages with perl.
>
> Short :
> Ping -> no reply -> SMS to my GSM
>
>
check out:
http://wkweb5.cableinet.co.uk/Npearce/email2SMS.html



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


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

Date: Wed, 13 Jan 1999 19:04:15 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Simple regexp (I think =b)
Message-Id: <fqfj77.qe6.ln@magna.metronet.com>

Forrest Reynolds (dropzone@mail.utexas.edu) wrote:
: here's something to start with: (caveat: I'm new to regex)

: $rough_price =~ m/>\$([0-9]+\.[0-9][0-9])</;
: $price_you_wanted = $1; # $1 matches the parentheses in regex


   But $1 is *only* changed if the match *succeeded*.

   If it failed, it will have whatever value it had before 
   the match attempt.


   Therefore, you should *always* test the match before using $1:

    $price_you_wanted = $1 if $rough_price =~ m/>\$([0-9]+\.[0-9][0-9])</;


   But Perl provides shortcuts for those [0-9] character classes,
   and a more succinct way of saying "match two times":

    $price_you_wanted = $1 if $rough_price =~ m/>\$(\d+\.\d{2})</;


: (truism masquerading as caveat: there's probably a slicker
: way to do this.)


   Since Ketan has _guaranteed_ that there is always a '<'
   following the price, and that the only dollar sign is
   before the price, we can use that information
   to slickify it:


      my $price_you_wanted = $1 if $rough_price =~ m/\$([^<]+)/;



: Ketan Patel wrote:

: > How could I get $price to equal '100.00' if the
: > string is "blahblah>$100.00<blahblah"


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


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

Date: Thu, 14 Jan 1999 05:34:57 GMT
From: posting.account@lookout.com (William Herrera)
Subject: Syntax help wanted:  "use strict" and sort $a and $b parameters...
Message-Id: <369d812f.425724751@news.rmi.net>

# Is this how this should work in Perl 5.001?
# I get an error regarding how $a and $b are
# defined with "use Strict" here. Why?
# is there an easy way to avoid the complaint:
#
# Global symbol "a" requires explicit package name at test0.pl line 
# 27.
# Global symbol "b" requires explicit package name at test0.pl line
# 27.
# Execution of test0.pl aborted due to compilation errors.


# enter file wildcard, sort by name, output.

use strict;

my(@files) = @ARGV;

my(@sorted) = sort byName @files;

foreach (@sorted)
{
    print "$_\n";
}

exit;

sub byName
{
    return $a cmp $b;
}


---
The above from: address is spamblocked. Use wherrera (at) lynxview (dot) com for the reply address.


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

Date: 14 Jan 1999 04:40:16 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: where can I get perlfunc.pod
Message-Id: <77jsfg$hjh$2@client2.news.psi.net>

Michael J. Wrobel (mjw@hrb.com) wrote on MCMLXI September MCMXCIII in
<URL:news:369D13C6.1804506@hrb.com>:
|| what is perlfun.pod?


In your Perl distribution.


Abigail


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

Date: Thu, 14 Jan 1999 06:05:59 GMT
From: rga@io.com
Subject: Re: Why doesn't it work?
Message-Id: <77k1g2$919$1@nnrp1.dejanews.com>



String operator needed
> if ($url eq "index") {

In article <778p9v$dqs$1@news2.news.iol.ie>,
  "Martin Harrigan" <harrigan@mailexcite.com> wrote:
> I'm trying to write a perl script to redirect a user to a page based on the
> argument after the ?. Can anyone tell me where I'm going wrong?
>
> #!/usr/local/bin/perl
> # Ex. http://www.domain.com/scripts/redirect.pl?url=index
> # will bring the user to the index page.
>
> $url = param('url');
>
> if ($url == "index") {
>    print "Location: http://www.domain.com/user/index.html";
> }
> elsif ($url == "help") {
>    print "Location: http://www.domain.com/user/help.html";
> }
> else {
>    print "Location: http://www.domain.com/user/error.html";
> }
>
>

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


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

Date: Wed, 13 Jan 1999 23:28:44 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Yet another REGEX question
Message-Id: <1dllfbi.1eohcd89chz4dN@bay1-541.quincy.ziplink.net>

John Moreno <phenix@interpath.com> wrote:

> Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:
> 
> > John Moreno <phenix@interpath.com> wrote:
> > 
> > > The [+-] was indeed in case there was a sign present, * means zero or
> > > more, since the ? means to use a non-greedy match, and that's irrelevant
> > > at that point, I didn't use it (and the more strict test would have been
> > > [+-]{0,1} to make sure that there wasn't more than one).
> > 
> > {0,1}...
> > 
> > ?, anyone?
> 
> D'OH.  I'm so stupid.
> 
> I thought he meant why wasn't it [+-]*?  -- HEY, I just checked he DID
> ask why it wasn't [+-]*?.

Perhaps I need to be more explicit...

You said that you should have written [+-]{0,1} to make sure there
wasn't more than one sign.  I pointed out that (as I'm sure must have
slipped your mind) {0,1} is usually written as ?.  So, you should have
used [+-]? in your regex.

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


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

Date: Thu, 14 Jan 1999 00:51:32 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Yet another REGEX question
Message-Id: <1dlljpj.1meg08b1vwl79bN@roxboro0-033.dyn.interpath.net>

Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:

> John Moreno <phenix@interpath.com> wrote: 
-snip-
> You said that you should have written [+-]{0,1} to make sure there
> wasn't more than one sign.  I pointed out that (as I'm sure must have
> slipped your mind) {0,1} is usually written as ?.  So, you should have
> used [+-]? in your regex.

Yep.

-- 
John Moreno


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

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


Administrivia:

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

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

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 4647
**************************************

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