[29187] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 431 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 12 21:10:08 2007

Date: Sat, 12 May 2007 18:09:10 -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           Sat, 12 May 2007     Volume: 11 Number: 431

Today's topics:
        Creating .txt/.html file using perl script jdblackford@gmail.com
    Re: Creating .txt/.html file using perl script <spamtrap@dot-app.org>
    Re: Creating .txt/.html file using perl script <wahab-mail@gmx.de>
    Re: Firefox -- browsing activity logger? <ignoramus6369@NOSPAM.6369.invalid>
    Re: Identify if a scalar is int, double or text <uri@stemsystems.com>
    Re: Identify if a scalar is int, double or text <klaus03@gmail.com>
    Re: multiline CSV records (comma-separated values forma <iler.ml@gmail.com>
        Perl Tutorial With Exercises <prateek.ja@gmail.com>
    Re: Perl Tutorial With Exercises <bik.mido@tiscalinet.it>
    Re: Perl Tutorial With Exercises <mritty@gmail.com>
    Re: Regular Expression Question <wahab-mail@gmx.de>
    Re: Regular Expression Question <someone@example.com>
    Re: Regular Expression Question <paduille.4061.mumia.w+nospam@earthlink.net>
    Re: Regular Expression Question <purlgurl@purlgurl.net>
    Re: Regular Expression Question <wahab-mail@gmx.de>
    Re: Trouble with printing newlines to a file <1usa@llenroc.ude.invalid>
    Re: use warnings and -w behaviour <awkster@yahoo.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 12 May 2007 14:45:22 -0700
From: jdblackford@gmail.com
Subject: Creating .txt/.html file using perl script
Message-Id: <1179006322.022267.58030@o5g2000hsb.googlegroups.com>

Hello,

I was wondering if it was possible to create simple program that will
create .txt (or .html) files based on information provided via
prompts.  If so, would someone be willing to assist me with this?  I
know absolutely nothing about Perl (or any other programming language
for that matter)

For instance, if I wanted to create a file called 01.20.07.html based
off of a specific date (01 is MM, 20 is DD, 07 is YY) that looked like
this:

<html>
<body>
<table>
<tr><td><img src="http://www.mywebsite.com/01.20.07/1.JPG">
<td><img src="http://www.mywebsite.com/01.20.07/2.JPG">
<td><img src="http://www.mywebsite.com/01.20.07/3.JPG">
</tr>
<tr><td><img src="http://www.mywebsite.com/01.20.07/4.JPG">
<td><img src="http://www.mywebsite.com/01.20.07/5.JPG">
<td><img src="http://www.mywebsite.com/01.20.07/6.JPG">
</tr>
</body>
</html>

I would like to be able to enter the following information when
prompted by the program:

MM
DD
YY
Number of images

If possible, I would like to have the code know how many table rows to
create (in intervals of 3) based on the number of images.

Is this something someone here can assist with?



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

Date: Sat, 12 May 2007 18:09:58 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Creating .txt/.html file using perl script
Message-Id: <m2fy61k821.fsf@local.wv-www.com>

jdblackford@gmail.com writes:

> Is this something someone here can assist with?

Sure - give it your best shot, and if you run into difficulties, post the
code you need assistance with, and ask for help with it.

If you're new to Perl, be sure to read the posting guidelines for this
group. They're posted two or three times a week (I forget which), so a
copy of them should still be available on your new server. The guidelines
include a lot more than "miss manners" type stuff - there are also a lot
of tips, pointers, and links there to help you get started.

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Sun, 13 May 2007 00:31:40 +0200
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: Creating .txt/.html file using perl script
Message-Id: <f25i4l$os3$1@mlucom4.urz.uni-halle.de>

jdblackford@gmail.com wrote:
> I was wondering if it was possible to create simple program that will
> create .txt (or .html) files based on information provided via
> prompts.  If so, would someone be willing to assist me with this?  I
> know absolutely nothing about Perl (or any other programming language
> for that matter)
> 
> For instance, if I wanted to create a file called 01.20.07.html based
> off of a specific date (01 is MM, 20 is DD, 07 is YY) that looked like
> this:

So you would like call it like

   perl myprogram.pl 01 20 07 9

to produce the desired output?


> I would like to be able to enter the following information when
> prompted by the program:
> MM
> DD
> YY
> Number of images

You already had to type the program name in order
to start it, so adding the parameters directly would
simplify the program and allows to mechanize your work
later.

Or did you think of 'clicking a file in explorer and
entering info then'?

> If possible, I would like to have the code know how many table rows to
> create (in intervals of 3) based on the number of images.
> Is this something someone here can assist with?

I'm not really sure what you intend to solve and
what would be the best way to do it.

Your specification is 'proforma' (without "entering info then")
fulfilled by a short perl script like:
==>
use strict;
use warnings;
use CGI qw':standard';


  my $link = 'http://www.mywebsite.com/$$D.$$M.$$Y/$$N.JPG';
  my %transf = ( D => shift,  M => shift, Y => shift );
  $link =~ s/\$\$$_/$transf{$_}/ for keys %transf;
  my ($n, $rows) = (1, (shift)/3);

  my $html =
       start_html('Image Gallery')
     . table(
         Tr([
             map
             td([ map {my $l=$link; $l=~s/\$\$N/$n++/e; img({src=>$l})."\n"} 1..3 ] ),
             1..$rows
           ])
       )
     . end_html();

  open my $fhd, '>', 'jdblackford.html' or die "cant't write files: $!";
  print $fhd $html;
  close $fhd;
<==


which you might invoke as said on line 14 of this posting.

But maybe you give us some more information first -
why Perl for example (if you didn't ever touch it)
and so on.

Regards

Mirco


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

Date: Sat, 12 May 2007 11:30:39 -0500
From: Ignoramus6369 <ignoramus6369@NOSPAM.6369.invalid>
Subject: Re: Firefox -- browsing activity logger?
Message-Id: <lJ6dnfDEyv0ydtjbnZ2dnUVZ_tPinZ2d@giganews.com>

On Sat, 12 May 2007 06:55:24 GMT, Bart Lateur <bart.lateur@pandora.be> wrote:
> Ignoramus6365 wrote:
>
>>I have a hell of a time in doing so, due to Google's use of
>>javascript, which is not known to WWW::Mechanize. This is by far not
>>my first web scraping script, I did maybe a dozen or two prior, but I
>>am not getting headway with it. I tried and tried and thought that I
>>was doing a perfect job, but still I fail. 
>
> Try one of the other scrapers instead, that use a browser's core to
> scrape. For your application (Firefox, Linux) I suspect
> Mozilla::Mechanize might work.
>
> 	http://search.cpan.org/perldoc?Mozilla::Mechanize
>
> (Oddly enough, the introduction to it is not found in the POD, but in
> the README:
>
> 	http://search.cpan.org/dist/Mozilla-Mechanize/README
> )
>
> That is, if you can get the module it depends upon, Gtk2::MozEmbed, to
> work.
>
> 	http://search.cpan.org/dist/Gtk2-MozEmbed/
>
>

This is AWESOME. I am going to install it right away. Thanks.

i


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

Date: Sat, 12 May 2007 18:39:52 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Identify if a scalar is int, double or text
Message-Id: <x7wszdevik.fsf@mail.sysarch.com>

>>>>> "K" == Klaus  <klaus03@gmail.com> writes:

  K> I want to stay with the standard built-in "int / double" arithmetic,
  K> but I want additional control of the transition between the (as I see
  K> it) 3 types of numerical values:

  K> type 1. (int)
  K> type 2. (double, with only integral values)
  K> type 3. (double, with free decimal values)

  K> This control should be implemented efficiently, hence my preference
  K> for subroutines written in C.

you can force integer match with use integer. but the normal way to
manage money exactly has always been to use an integer for the lowest
denomination. this means for dollars you count integer cents. only when
you convert in/out for printing do you deal with the decimal point. this
way you get total control, speed, accuracy, and easy rounding with
int(). if you want more accuracy (.1 cents) just make that your count
size. and you can overflow to float as a large int (> 32 bits) and get
47 bits of int so there will never be a loss of digits until you get to
be richer than uncle bill.

and i agree with paul, needing to know so much detail is not
perlish. using ints for money is what you want to do and is easy in
perl.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 12 May 2007 13:01:15 -0700
From: Klaus <klaus03@gmail.com>
Subject: Re: Identify if a scalar is int, double or text
Message-Id: <1179000075.771716.299520@l77g2000hsb.googlegroups.com>

On May 12, 8:39 pm, Uri Guttman <u...@stemsystems.com> wrote:
> >>>>> "K" == Klaus  <klau...@gmail.com> writes:
>
>   K> I want to stay with the standard built-in "int / double" arithmetic,
>   K> but I want additional control of the transition between the (as I see
>   K> it) 3 types of numerical values:
>
>   K> type 1. (int)
>   K> type 2. (double, with only integral values)
>   K> type 3. (double, with free decimal values)
>
>   K> This control should be implemented efficiently, hence my preference
>   K> for subroutines written in C.
>
> you can force integer match with use integer. but the normal way to
> manage money exactly has always been to use an integer for the lowest
> denomination. this means for dollars you count integer cents. only when
> you convert in/out for printing do you deal with the decimal point. this
> way you get total control, speed, accuracy, and easy rounding with
> int(). if you want more accuracy (.1 cents) just make that your count
> size. and you can overflow to float as a large int (> 32 bits) and get
> 47 bits of int so there will never be a loss of digits until you get to
> be richer than uncle bill.
>
> and i agree with paul, needing to know so much detail is not
> perlish. using ints for money is what you want to do and is easy in
> perl.

I see, but my accounting program in Perl needs exact rounding (to the
cent) in a lot of places. As a consequence, the program is littered
with sprintf("%.0f") to get the rounding I need (I can't use integer,
because my monetary values exceed 32 bits and I don't want to use
bigint to avoid the overhead).

Let me please present a simple example which hopefully explains my
point:

Let's assume for the sake of the argument, I had to write an
accounting program in Perl which calculates the * exact * annual
interest rate at 6.3% for Bill's account balance:

=====================================
my $Bills_Balance   = 52_625_587_938_19;
my $Annual_Interest = $Bills_Balance * 0.063;
my $Exact_Interest  = sprintf("%.0f", $Bills_Balance * 0.063);
print "Balance        = $Bills_Balance\n";
print "Interest       = $Annual_Interest\n";
print "Exact Interest = $Exact_Interest\n";
=====================================
Output:
=====================================
Balance        = 5262558793819
Interest       = 331541204010.597
Exact Interest = 331541204011
=====================================

Maybe it is not perlish, but I would very much prefer to have the
variable "$Exact_Interest" tied to an efficient C-subroutine to
replace the ugly sprintf("%.0f").

I am not an expert on "tie" and I have just started reading "perldoc
perltie", but here is my vision of how I would like to be able to re-
write the example program:

=====================================
use Efficient_C_Subroutine_to_replace_rounding_with_sprintf;

my ($Annual_Interest, $Exact_Interest);
tie $Exact_Interest,
'Efficient_C_Subroutine_to_replace_rounding_with_sprintf;

my $Bills_Balance   = 52_625_587_938_19;

$Annual_Interest = $Bills_Balance * 0.063;
$Exact_Interest = $Bills_Balance * 0.063;

print "Balance        = $Bills_Balance\n";
print "Interest       = $Annual_Interest\n";
print "Exact Interest = $Exact_Interest\n";
=====================================

I have searched CPAN, but I haven't yet found such a module.

--
Klaus



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

Date: 12 May 2007 15:39:08 -0700
From: Yakov <iler.ml@gmail.com>
Subject: Re: multiline CSV records (comma-separated values format)
Message-Id: <1179009548.787912.280610@u30g2000hsc.googlegroups.com>

On Apr 25, 7:43 pm, Purl Gurl <purlg...@purlgurl.net> wrote:
> Yakov wrote:
> > Which CVS parser on cpan supportsmultilineCSVfields/records ?
> > Searching forCSVmodules on cpan, I get impression that most of
> > them do not suportmultilinevalues.
>
> Clearly there exists a delimiter between records, even if
> records span multiple lines.

In multiline CSV, odd number of double-quotes in the record signals
the unfinished record.
This is how multiline CSV works.  The record delimiter in multiline
CSV is \n, same as in
single-line CSV. Remotely like in multiline "..." perl string, newline
is just embedded into double-quoted csv field (except that ["] is
escaped by doubling it rather than turning it into \").
In multiline CSV, \n is also end of CSV record, and also the eof
embedded in the csv field.

Here is example of one csv record containing 2 fields, each being
multiline:

"first line of field 1 record 1...
second line of field 1 record 1","first line of field 2 record 1...
second line of field 2 record 1"


Yakov



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

Date: 12 May 2007 09:45:09 -0700
From: "prateek.ja" <prateek.ja@gmail.com>
Subject: Perl Tutorial With Exercises
Message-Id: <1178988309.839009.201510@h2g2000hsg.googlegroups.com>

Hi,

Can anybody suggest a good online perl tutorial which also has
exercises which could be worked upon.
I would be really grateful to anyone providing the same. I'm a newbie
to perl but have idea about computer languages. So a intermediate
level tutorial would do.



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

Date: Sat, 12 May 2007 19:14:40 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Perl Tutorial With Exercises
Message-Id: <vdtb43prjgm8m2cg9ui9koakp4g34rcm5s@4ax.com>

On 12 May 2007 09:45:09 -0700, "prateek.ja" <prateek.ja@gmail.com>
wrote:

>Can anybody suggest a good online perl tutorial which also has
>exercises which could be worked upon.

I don't know if any of the tutorials at PerlMonks have exercises. But
you may want to look there anyway:

http://perlmonks.org/?node=Tutorials


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: 12 May 2007 16:04:43 -0700
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Perl Tutorial With Exercises
Message-Id: <1179011083.718997.38770@k79g2000hse.googlegroups.com>

On May 12, 12:45 pm, "prateek.ja" <prateek...@gmail.com> wrote:
> Can anybody suggest a good online perl tutorial which also has
> exercises which could be worked upon.
> I would be really grateful to anyone providing the same. I'm a newbie
> to perl but have idea about computer languages. So a intermediate
> level tutorial would do.

Beginning Perl, by Simon Cozens, is a free online ebook, available at
http://www.perl.org/books/beginning-perl/

I also recommend the non-free, paper book called Learning Perl, by
Randal Schwartz.

Both contain sample exercises to work on at the end of each chapter.

Paul Lalli



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

Date: Sat, 12 May 2007 15:08:05 +0200
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: Regular Expression Question
Message-Id: <f24ein$e8u$1@mlucom4.urz.uni-halle.de>

jonasforssell@yahoo.se wrote:
> Hello,
> 
> 
> I have a file like this:
> 
> 2 45 3
> 3 44 2 65
> 
> In other words, the first number states how many follwing numbers
> there will be.
> 
> ^([0-9]) ([0-9]){$1}$
> 
> The above regexp does not seem to work for parsing this. I guess the
> $1 parameter is not accepted.
> Any ideas of an alternative?

You could use dynamic quantifier. I'm not sure,
one can put \1 directly into a quantifier
(maybe it works sometimes).

This works - dynamic quantifier by (??{ ... })

  ...

  print grep /^                       # lock to start of line
             (\d+)\s+                 # extract quantifier + space
             (??{ "(\\d+\\s+){$1}" }) # construct the (\d+\s+){N} thing
             $                        # lock to end of line
             /x, <DATA>;

  ...

__DATA__
2 45 3
3 44 2 65
5 43 4 43 4444
1 43 4 43 4444
3 44 2 65

Regards

M.


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

Date: Sat, 12 May 2007 13:43:34 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Regular Expression Question
Message-Id: <awj1i.3184$V75.1102@edtnps89>

jonasforssell@yahoo.se wrote:
> 
> I have a file like this:
> 
> 2 45 3
> 3 44 2 65
> 
> In other words, the first number states how many follwing numbers
> there will be.
> 
> ^([0-9]) ([0-9]){$1}$
> 
> The above regexp does not seem to work for parsing this. I guess the
> $1 parameter is not accepted.
> Any ideas of an alternative?

while ( <FILE> ) {
    my ( $count, @data ) = /\d+/g;
    if ( $count == @data ) {
        print "Yes!  we have valid data.\n";
        }
    else {
        warn "Error: expected $count elements but received " . @data . "
instead.\n";
        }
    }



John
-- 
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.       -- Larry Wall


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

Date: Sat, 12 May 2007 14:37:57 GMT
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: Regular Expression Question
Message-Id: <9jk1i.6229$296.5977@newsread4.news.pas.earthlink.net>

On 05/12/2007 07:08 AM, jonasforssell@yahoo.se wrote:
> Hello,
> 
> 
> I have a file like this:
> 
> 2 45 3
> 3 44 2 65
> 
> In other words, the first number states how many follwing numbers
> there will be.
> 
> ^([0-9]) ([0-9]){$1}$
> 
> The above regexp does not seem to work for parsing this. I guess the
> $1 parameter is not accepted.
> Any ideas of an alternative?
> 
> Thanks
> /Jonas
> 

The task is complicated by the fact that $1 is not valid until the 
regular expression that sets it is finished. Here's one way to do it:

     my $data = q{ 2 45 3      5 6 7 8 };
     # 5 6 7 and 8 should be ignored.

     my @nums = do {
         $data =~ /^ *(\d) ([\d ]+)/
         && ($2 =~ /((?:\d+ +){$1})/)
         && ($1 =~ /\d+/g)
     };



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

Date: Sat, 12 May 2007 07:48:59 -0700
From: Purl Gurl <purlgurl@purlgurl.net>
Subject: Re: Regular Expression Question
Message-Id: <8uCdnZliutNCTtjbnZ2dnUVZ_ternZ2d@giganews.com>

jonasforssell wrote:

(snipped)

> I have a file like this:

> 2 45 3
> 3 44 2 65

> In other words, the first number states how many follwing numbers
> there will be.

> ^([0-9]) ([0-9]){$1}$

> The above regexp does not seem to work for parsing this. I guess the

Your article is basic gibberish. You have failed
to state your objective.

You write, "...parsing this."

Parsing what? What is your task? What are your
expected produced results?

Readers can only guess at your task. Guessing
is not a viable programming method.

My best guess is, based on your gibberish, is
you want to verify there are as many numbers
as set by your first number in your data.

Simply count your spaces.

A presumption is made your data will be precisely
as displayed, this is, there will be as many spaces
as numbers following your initial index number.

However, this seems illogical. Why do you need to
know how many numbers are available? I am sure there
is a reason but your gibberish does not disclose why.

Strikes me your software which writes your data would
error check eliminating any need to error check later.
Rather than pull your data to error check, make sure
your data writer software does not introduce errors.
You are going about this backwards.

In the future, work towards writing articles which
are clear, concise and coherent.

Purl Gurl

Here is a simple basic example of counting spaces
for your parameters. However, because your article
is gibberish, I do not know if this will meet your
task; you may need to modify for whatever.


#!perl

while (<DATA>)
  {
   if (($_ =~ tr/ //) == (substr ($_, 0, index ($_, " "))) && ($_ !~ / $/))
    { print "OK\n"; }
   else
    { print "NOT OK\n"; }
  }



__DATA__
0
1
2 45 3
3 44 2 65
4 1 2 BAD
10 1 2 3 4 5 6 7 8 9 10



PRINTED RESULTS:

OK
NOT OK
OK
OK
NOT OK
OK


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

Date: Sat, 12 May 2007 17:42:54 +0200
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: Regular Expression Question
Message-Id: <f2501d$j4k$1@mlucom4.urz.uni-halle.de>

John W. Krahn wrote:
> while ( <FILE> ) {
>    my ( $count, @data ) = /\d+/g;
>    if ( $count == @data ) {
>       print "Yes!  we have valid data.\n";
>       }
>    else {
>       warn "Error: expected $count elements but received " . @data . " instead.\n";
>         }
>    }

Good idea!

in Perl, your approach would then look like

    my @data = grep $_->[0] == @$_-1, map [split], <FILE>;

or something, I guess ;-)

Regards

M.



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

Date: Sat, 12 May 2007 16:19:07 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Trouble with printing newlines to a file
Message-Id: <Xns992E7D5A76594asu1cornelledu@127.0.0.1>

"Dr.Ruud" <rvtol+news@isolution.nl> wrote in news:f24bg2.v4.1
@news.isolution.nl:

> shaneal schreef:
> 
>> I want to be able to print just an "LF" to a file.
>> [...] Windows 
> 
> perldoc -f binmode
> 
> (search on 'Windows' in there) 
> 

Also, if one wants specific characters, it is better to specify them by 
their codes rather than using \n whose meaning depends on what the 
platform thinks a line ending ought to be.

See also: <http://kobesearch.cpan.org/htdocs/perl/Socket.pm.html#CR->


Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: 12 May 2007 08:31:19 -0700
From: Jorge <awkster@yahoo.com>
Subject: Re: use warnings and -w behaviour
Message-Id: <1178983879.746098.67090@e65g2000hsc.googlegroups.com>

On May 11, 1:44 pm, a...@alumni.caltech.edu (Gary E. Ansok) wrote:
> In article <4644d263$0$6396$9b4e6...@newsspool2.arcor-online.net>,
> Christian Winter  <thepoet_nos...@arcor.de> wrote:
>
>
>
> >Jorge wrote:
> >> When I use the -w in the shebang line ...
>
> >> #!/usr/local/bin/perl -w
>
> >> the scripts run just fine but when I switch to the 'use warnings'
> >> pragma ...
>
> >> I get the error ...
>
> >> Command not found
>
> >> Can anyone shed some light on this?
>
> >When switching to "use warnings;" you didn't by accident delete
> >or modify the rest of the shebang line (i.e. #!/usr/local/bin/perl)?
>
> >The error itself doesn't look like a Perl message, so it's either
> >the shell on the Solaris server or your local cmd that emits it.
>
> One possibility to check out is that your script still has
> the Windows \r\n line endings.  Perl generally treats the
> \r (CR, CTRL-M, \015) as just another space character, but
> on the shebang line it can make a difference:
>
> #! /usr/local/bin/perl -w\r
> The shell looks for /usr/local/bin/perl, finds it, and passes -w\r
> to perl as a command-line argument (and perl ignores the \r).
>
> #! /usr/local/bin/perl\r
> The shell looks for /usr/local/bin/perl\r and can't find it.
>
> If your file transfer program has an option to transfer files
> in "text" mode, use that -- it will convert the line endings.
> If your file transfer program doesn't have such an option, or
> if you're transferring an archive full of scripts at once,
> then see if your system has a utility like "dos2unix" available.
> If not, it's easy enough to write a quick Perl script to remove
> the \r characters.
>
> Gary Ansok
> --
> Besides, there's nothing like the threat of imminent death
> to force one to delegate.  -- Lois McMaster Bujold


Yup -- it was the 2-byte newlines that were causing the problem.

dos2unix fixed it.

Thanks much to all that sent a reply.

Jorge



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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 431
**************************************


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