[16191] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3603 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 10 19:34:12 2000

Date: Mon, 10 Jul 2000 16:34:01 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963272041-v9-i3603@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 10 Jul 2000     Volume: 9 Number: 3603

Today's topics:
        String length? <srh104@york.ac.uk>
    Re: String length? <jbritain@home.com>
    Re: String length? (Abigail)
    Re: String length? (Craig Berry)
    Re: String length? <palincss@his.com>
    Re: String length? (Marcel Grunauer)
    Re: String length? prakash_ojha@my-deja.com
    Re: String length? (Craig Berry)
    Re: String length? <phill@modulus.com.au>
    Re: String length? <iltzu@sci.invalid>
    Re: String length? (Tad McClellan)
    Re: String length? <nnickee@nnickee.com>
    Re: String length? (Merijn Broeren)
    Re: String length? <y-o-y@home.com>
    Re: String length? (Bernard El-Hagin)
    Re: String length? <iltzu@sci.invalid>
    Re: String length? (Bernard El-Hagin)
    Re: String length? mexicanmeatballs@my-deja.com
    Re: String length? <iltzu@sci.invalid>
    Re: String length? (Malcolm Dew-Jones)
        Strip Line Feeds? <jblackburn@fapo.com>
    Re: Strip Line Feeds? (David Efflandt)
    Re: Strip Line Feeds? <jblackburn@fapo.com>
        Stupid newbie questions. sam_hardman@my-deja.com
    Re: Stupid newbie questions. <aqumsieh@hyperchip.com>
    Re: Stupid newbie questions. (Tad McClellan)
    Re: Stupid newbie questions. sam_hardman@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 09 Jul 2000 12:46:29 +0100
From: "Simon H." <srh104@york.ac.uk>
Subject: String length?
Message-Id: <39686614.113B5839@york.ac.uk>

Is there a quick way in Perl (like the predefined methods in, say, Java)
to get the length of a string in terms of number of characters?

TIA
Simon H.






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

Date: Sun, 09 Jul 2000 12:09:41 GMT
From: Jim Britain <jbritain@home.com>
Subject: Re: String length?
Message-Id: <6mpoOTE6VonwgiU6XHmr+suOLCLf@4ax.com>

On Sun, 09 Jul 2000 12:46:29 +0100, "Simon H." <srh104@york.ac.uk>
wrote:

>Is there a quick way in Perl (like the predefined methods in, say, Java)
>to get the length of a string in terms of number of characters?

You mean something like $bytes=length("string"); ??

type: 
perldoc -f length
at the command line.



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

Date: 09 Jul 2000 10:46:49 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: String length?
Message-Id: <slrn8mh549.tts.abigail@alexandra.delanet.com>

Simon H. (srh104@york.ac.uk) wrote on MMDIV September MCMXCIII in
<URL:news:39686614.113B5839@york.ac.uk>:
@@ Is there a quick way in Perl (like the predefined methods in, say, Java)
@@ to get the length of a string in terms of number of characters?


No. Not at all. In Perl, strings are variable, and hence, their length
chances. Please don't look at the manual. That's all lies, damned lies
and faerie tales.


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


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

Date: Sun, 09 Jul 2000 17:24:58 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: String length?
Message-Id: <smhdbaqcnu159@corp.supernews.com>

Simon H. (srh104@york.ac.uk) wrote:
: Is there a quick way in Perl (like the predefined methods in, say, Java)
: to get the length of a string in terms of number of characters?

Yeah, right; like anyone would ever want to do that.  I mean, if that were
useful, it would be right out there in the copious free documentation
installed on your very own system, right?  And prominently featured in the
recommended reference books as well, I'll bet.  But, since you're a good
netizen, I'm sure you checked all those places before posting this, so no
method for determining a string's length exists in Perl.  Perhaps we can
hope for one to be included in 5.8. 

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Beauty and strength, leaping laughter and delicious
   |   languor, force and fire, are of us." - Liber AL II:20


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

Date: Sun, 09 Jul 2000 21:45:34 GMT
From: Steve Palincsar <palincss@his.com>
Subject: Re: String length?
Message-Id: <3968F2C5.B23D2206@his.com>

Craig Berry wrote:
> 
> Simon H. (srh104@york.ac.uk) wrote:
> : Is there a quick way in Perl (like the predefined methods in, say, Java)
> : to get the length of a string in terms of number of characters?
> 
> Yeah, right; like anyone would ever want to do that.  I mean, if that were
> useful, it would be right out there in the copious free documentation
> installed on your very own system, right?  And prominently featured in the
> recommended reference books as well, I'll bet.  But, since you're a good
> netizen, I'm sure you checked all those places before posting this, so no
> method for determining a string's length exists in Perl.  Perhaps we can
> hope for one to be included in 5.8.

<jape>
Well, one could always create an array of characters by splitting on the
null string, then evaluating the array in a scalar context.  There's
always more than one way to do it...
</jape>


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

Date: Sun, 09 Jul 2000 23:00:38 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: String length?
Message-Id: <slrn8mi1bh.51o.marcel@gandalf.local>

On Sun, 09 Jul 2000 21:45:34 GMT, Steve Palincsar <palincss@his.com> wrote:
>
><jape>
>Well, one could always create an array of characters by splitting on the
>null string, then evaluating the array in a scalar context.  There's
>always more than one way to do it...
></jape>


Sure there is another way to do it:

	sub strlen {
		my $s = shift;
		my $l = 0;
		$l++ while substr($s,0,1,'');
		return $l;
	}


-- 
Marcel
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();


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

Date: Mon, 10 Jul 2000 03:44:02 GMT
From: prakash_ojha@my-deja.com
Subject: Re: String length?
Message-Id: <8kbgq0$sbl$1@nnrp1.deja.com>

I'm pretty new myself, but try like this, it works.

$string = "an apple a day";
foreach $byte (split //, $string) {

	$length++;
}
print $length;


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 10 Jul 2000 04:14:40 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: String length?
Message-Id: <smijdgtsnu115@corp.supernews.com>

Steve Palincsar (palincss@his.com) wrote:
: <jape>
: Well, one could always create an array of characters by splitting on the
: null string, then evaluating the array in a scalar context.  There's
: always more than one way to do it...
: </jape>

Finding alternate length measurement algorithms might be kind of fun.
Here's my submission:

  sub stupid_length {
    my $str = shift;
    my $len = 0;
    $len++ until substr($str, 0, $len) eq $str;
    $len;
  }

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Beauty and strength, leaping laughter and delicious
   |   languor, force and fire, are of us." - Liber AL II:20


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

Date: Mon, 10 Jul 2000 16:13:09 +1000
From: Peter Hill <phill@modulus.com.au>
Subject: Re: String length?
Message-Id: <39696975.7797@modulus.com.au>

Craig Berry wrote:
> 
> Steve Palincsar (palincss@his.com) wrote:
> : <jape>
> : Well, one could always create an array of characters by splitting on the
> : null string, then evaluating the array in a scalar context.  There's
> : always more than one way to do it...
> : </jape>
> 
> Finding alternate length measurement algorithms might be kind of fun.
> Here's my submission:
> 
>   sub stupid_length {
>     my $str = shift;
>     my $len = 0;
>     $len++ until substr($str, 0, $len) eq $str;
>     $len;
>   }
> 
> --
>    |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
>  --*--  "Beauty and strength, leaping laughter and delicious
>    |   languor, force and fire, are of us." - Liber AL II:20

The following should fit the OP's purpose admirably, and is definitely
'alternate'...

sub very_dumb_length{
   my $theStr = $_[0];
   my $len = 0;
   for (1..length($theStr)){
	$len++;
   }
   $len;
}

-- 
Peter Hill,
Modulus Pty. Ltd.,
http://www.modulus.com.au/


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

Date: 10 Jul 2000 06:29:38 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: String length?
Message-Id: <963209865.9387@itz.pp.sci.fi>

In article <smijdgtsnu115@corp.supernews.com>, Craig Berry wrote:
>Finding alternate length measurement algorithms might be kind of fun.
>Here's my submission:
>
>  sub stupid_length {
>    my $str = shift;
>    my $len = 0;
>    $len++ until substr($str, 0, $len) eq $str;
>    $len;
>  }

But isn't it rather inefficient to do a linear search?  Certainly a
binary search should be faster:

  sub absurd_length {
      use integer;
      my $str = shift;
      return 0 if $str eq '';
      my $max = 1;
      $max += $max until substr($str, 0, $max) eq $str;
      my $min = $max >> 1;
      while ($min < $max - 1) {
          my $avg = ($min + $max) >> 1;
          (substr($str, 0, $avg) eq $str ? $max : $min) = $avg;
      }
      $max;
  }

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method."  -- Abigail
Please ignore Godzilla and its pseudonyms - do not feed the troll.



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

Date: Mon, 10 Jul 2000 01:37:36 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: String length?
Message-Id: <slrn8mio90.so6.tadmc@magna.metronet.com>

On Mon, 10 Jul 2000 04:14:40 GMT, Craig Berry <cberry@cinenet.net> wrote:

>Finding alternate length measurement algorithms might be kind of fun.


   sub not_stupid_enough_length { $_[0] =~ tr/\000-\377//; }


   sub vec_length {
      my($str, $i) = @_;
      for ($i=0; vec $str, $i, 8; $i++){};
      $i;
   }


   sub twice_as_stupid_length {
      my($str) = @_;
      $str .= $str;
      my $len = 0;
      $len++ while $str =~ s/.(.*)./$1/s;
      $len;
   }


   sub four_times_as_stupid_length {
      my($str) = @_;
      $str .= $str;
      $str .= $str;
      my $len = 0;
      $len++ while $str =~ s/..(.*)../$1/s;
      $len;
   }


   sub eight_times_as_stupid_length {
      my($str) = @_;
      $str .= $str;
      $str .= $str;
      $str .= $str;
      my $len = 0;
      $len++ while $str =~ s/....(.*)..../$1/s;
      $len;
   }

   ...

   ...


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


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

Date: Mon, 10 Jul 2000 01:53:48 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: String length?
Message-Id: <EF542C670A6B371A.CA5E2CF7384D9644.7F7B4CD7A3BB1BBE@lp.airnews.net>

On Mon, 10 Jul 2000 16:13:09 +1000, someone claiming to be Peter Hill
<phill@modulus.com.au> said:

>Craig Berry wrote:

>> Finding alternate length measurement algorithms might be kind of fun.

>The following should fit the OP's purpose admirably, and is definitely
>'alternate'...

>sub very_dumb_length{
>   my $theStr = $_[0];
>   my $len = 0;
>   for (1..length($theStr)){
>	$len++;
>   }
>   $len;
>}

So... this would be like Perl Bowling or something, right?

Nnickee



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

Date: 10 Jul 2000 12:48:46 +0200
From: merijnb@iloquent.nl (Merijn Broeren)
Subject: Re: String length?
Message-Id: <8kc9me$1q1$1@brugman.iloquent.nl>

In article <963209865.9387@itz.pp.sci.fi>,
Ilmari Karonen  <usenet11148@itz.pp.sci.fi> wrote:
>In article <smijdgtsnu115@corp.supernews.com>, Craig Berry wrote:
>>  sub stupid_length {
>>    my $str = shift;
>>    my $len = 0;
>>    $len++ until substr($str, 0, $len) eq $str;
>>    $len;
>>  }
>  sub absurd_length {
>      use integer;
>      my $str = shift;
>      return 0 if $str eq '';
>      my $max = 1;
>      $max += $max until substr($str, 0, $max) eq $str;
>      my $min = $max >> 1;
>      while ($min < $max - 1) {
>          my $avg = ($min + $max) >> 1;
>          (substr($str, 0, $avg) eq $str ? $max : $min) = $avg;
>      }
>      $max;
>  }

But we aren't after faster are we? Or more efficient? What about
this:

sub this_takes_the_cake {
	my $str = shift;
	my $length_not_found = 1;
	my $try;
	while ($length_not_found) {
		# Shirley defined somewhere:)
		$try = rand($perls_biggest_integer);
		my $try_str = $str;
		for ($i = 1; $i <= $try; $i++) {
			chop $try_str;
			next if $try_str;
			$length_not_found = 0 if $i == $try;
			last;
		}
	}
	$try;
}

Nicely non-deterministic. 

Merijn








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

Date: Mon, 10 Jul 2000 12:47:13 GMT
From: Andy <y-o-y@home.com>
Subject: Re: String length?
Message-Id: <lBja5.37570$A%3.536268@news1.rdc2.pa.home.com>

Is something like this not reasonable...

$the_String = "Hello, world.";
$i=0;
while (substr $the_String, $i, 1 ne "undef") {
$i++;
}
print "$the_String has: $i characters\n";

Regards,

Andy
"As usual, the deceased is not available to speak for himself."
 --Tracy Ullman


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

Date: Mon, 10 Jul 2000 13:06:53 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: String length?
Message-Id: <slrn8mjias.9rf.bernard.el-hagin@gdndev25.lido-tech>

On Mon, 10 Jul 2000 12:47:13 GMT, Andy <y-o-y@home.com> wrote:
>Is something like this not reasonable...

It isn't for a number of reasons...

>$the_String = "Hello, world.";
>$i=0;
>while (substr $the_String, $i, 1 ne "undef") {
                                  ^^^^^^^^^^
What's that about?

>$i++;
>}
>print "$the_String has: $i characters\n";

The main reason that this is unreasonable is that you already have a
BUILT-IN function called LENGTH which does what you want. Why don't you
want to use it? Did you build Perl from a source which didn't contain
the code for the length function?

Bernard
--
perl -e'@x=(3,2,4,1,3,2,1,3,1,3,2,3,3,2,3,0,0,1,2,1,1,1,4,1,2,1,1,2,2,1,
2,1,2,1,2,1,2,1,1,1,2,1,0,0,3,2,3,2,3,2,1,1,1,1,1,2,4,2,3,2,1,2,1,0,0,1,
2,1,1,1,4,1,2,1,1,1,2,2,1,1,4,1,1,1,2,1,1,1,2,1,0,0,3,2,4,1,1,2,1,1,1,3,
1,1,1,4,1,1,1,2,1,1,3,0,0);sub x{print q x$xx$_;print q x x x shift@x};#
while(defined($_=shift @x)){s o0o\no;$_!=0?x:print}' #Symmetry yrtemmyS#


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

Date: 10 Jul 2000 13:31:04 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: String length?
Message-Id: <963235056.21605@itz.pp.sci.fi>

In article <slrn8mjias.9rf.bernard.el-hagin@gdndev25.lido-tech>, Bernard El-Hagin wrote:
>The main reason that this is unreasonable is that you already have a
>BUILT-IN function called LENGTH which does what you want. Why don't you
>want to use it? Did you build Perl from a source which didn't contain
>the code for the length function?

You haven't been following the thread very closely, have you?  ;-)

The idea was to find the length of the string _without_ using length(),
preferably in the most perverse possible way.  I still think my binary
search satisfied that requirement quite well, by applying not just one
but two different optimizations without addressing the actual cause of
its inefficiency in any way.

It could perhaps be improved, though.  As we can expect string lengths
to be exponentially distributed, it might be more efficient to use the
geometric rather than the arithmetic mean.  However this would involve
the computation of a square root, which would be slower than the shift
operation currently used.  This calls for a benchmark.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method."  -- Abigail
Please ignore Godzilla and its pseudonyms - do not feed the troll.



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

Date: Mon, 10 Jul 2000 13:46:30 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: String length?
Message-Id: <slrn8mjkl5.9rf.bernard.el-hagin@gdndev25.lido-tech>

On 10 Jul 2000 13:31:04 GMT, Ilmari Karonen <iltzu@sci.invalid> wrote:
>>The main reason that this is unreasonable is that you already have a
>>BUILT-IN function called LENGTH which does what you want. Why don't you
>>want to use it? Did you build Perl from a source which didn't contain
>>the code for the length function?
>
>You haven't been following the thread very closely, have you?  ;-)
>
>The idea was to find the length of the string _without_ using length(),
>preferably in the most perverse possible way.

Yes, I realise that, but I believe that I replied to the person who
originally instigated the whole mess by incessantly asking how to change
an integer into a string in order to find its length and proceeding to
ignore advice to use the length() function. If that's not the case I'm
sorry both for my abrasiveness and my bad memory for names. I never
forget a face, though. :-)

Bernard
--
perl -e'@x=(3,2,4,1,3,2,1,3,1,3,2,3,3,2,3,0,0,1,2,1,1,1,4,1,2,1,1,2,2,1,
2,1,2,1,2,1,2,1,1,1,2,1,0,0,3,2,3,2,3,2,1,1,1,1,1,2,4,2,3,2,1,2,1,0,0,1,
2,1,1,1,4,1,2,1,1,1,2,2,1,1,4,1,1,1,2,1,1,1,2,1,0,0,3,2,4,1,1,2,1,1,1,3,
1,1,1,4,1,1,1,2,1,1,3,0,0);sub x{print q x$xx$_;print q x x x shift@x};#
while(defined($_=shift @x)){s o0o\no;$_!=0?x:print}' #Symmetry yrtemmyS#


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

Date: Mon, 10 Jul 2000 13:49:59 GMT
From: mexicanmeatballs@my-deja.com
Subject: Re: String length?
Message-Id: <8kcka1$kcf$1@nnrp1.deja.com>

In article <8kbgq0$sbl$1@nnrp1.deja.com>,
  prakash_ojha@my-deja.com wrote:
> I'm pretty new myself, but try like this, it works.
>
> $string = "an apple a day";
> foreach $byte (split //, $string) {
>
> 	$length++;
> }
> print $length;
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

Ooh ooh recursion:

#!/usr/bin/perl -w
use strict;

my $string="A test type string";
print 'Length is:',dumb_len($string),"\n";
exit;

sub dumb_len {
    my ($string) = $_[0]=~/^(.*?)(.)$/;
    if($string ne "") {
	return(dumb_len($string)+1);
    }
    return(1);
}

This must waste the most memory....

JonBarker@NO.SPAMiname.com


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 10 Jul 2000 17:44:46 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: String length?
Message-Id: <963250102.14230@itz.pp.sci.fi>

In article <8kcka1$kcf$1@nnrp1.deja.com>, mexicanmeatballs@my-deja.com wrote:
>sub dumb_len {
>    my ($string) = $_[0]=~/^(.*?)(.)$/;
>    if($string ne "") {
>	return(dumb_len($string)+1);
>    }
>    return(1);
>}

I think you have a bug - what if the string contains newlines?

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method."  -- Abigail
Please ignore Godzilla and its pseudonyms - do not feed the troll.



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

Date: 10 Jul 2000 11:15:37 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: String length?
Message-Id: <396a12c9@news.victoria.tc.ca>

# get the length of a string, assuming its less than 70 characters long
# and has no line feeds, CRs, etc, in it

sub get_length
{  my $str = shift;
   print '
123456789 123456789 123456789 123456789 123456789 123456789 123456789
';
   print "$str\n";
   print "Please enter the length of the string: ";

   $length = <STDIN>;
   return $length;
}



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

Date: Thu, 6 Jul 2000 11:14:01 -0700
From: "Jim Blackburn" <jblackburn@fapo.com>
Subject: Strip Line Feeds?
Message-Id: <N%395.1535$0x.49038@nuq-read.news.verio.net>

Hi,

I'm using a script from a contact manager software program called Goldmine,
where it allows users to enter data on a form on the web and the resulting
e-mail (processed through their script) is then imported into the contact
manager. The html form has a textfield called "Notes". The problem: if the
person filling out the form hits the "Enter" key while entering text into
the textfield, any additional text they enter after hitting the "Enter" key
is not passed through. Is there a way to enter something in the script that
would strip away the "Enter" key? Any other ideas? I'd be grateful; Goldmine
appears to be stumped on this.

If it helps, here's a copy of their basic script (mine is running on an
Apache server):

#!/usr/local/bin/perl
# check for the POST method
if ($ENV{'REQUEST_METHOD'} eq 'POST')

{
  # How many bytes are we supposed to receive?
  read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
  # make a list of keyword/value pairs
  @pairs = split(/&/, $buffer);
  # cycle through each pair and decipher the values
  foreach $pair (@pairs)

 {
    # get the name/value pair strings
    ($name, $value) = split(/=/, $pair);
    # translate "+" to a space
    $value =~ tr/+/ /;
    # decipher ASCI hexidecimal escaped characters, if any
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# find profile/contsupp field names that begin with cs*_
if ($name =~ /cs\d_/)
  #add the profile/contsupp pair to a list keyed on the name of the variable
  {$csarry{$name} = $value;}
else {
  #add the basic field data pair to a list keyed on the name of the variable
  $contents{$name} = $value;

}

 }

}
($mon,$day,$year) = split(m|/|,`/bin/date +%B/%e/%Y`);
$date = "$mon $day, $year";
$to = $contents{'email_to'};
&mailto;
&thankyou;

###############
## subroutines from here on down!
###############


sub thankyou {
print "Location: http://www.goldmine.com/thankyou.htm\n\n";
exit;
}

sub mailto {
open (MAIL, "|/usr/lib/sendmail -t") || die "can't open pipe to sendmail
\n";
print MAIL "Content-Type: application/x-gm-impdata\n";
print MAIL "To: $to\n";
print MAIL "From: $csarry{'cs2_ContSupRef'}\n";
print MAIL "Subject: datafromgoldform.pl\n";
print MAIL "\n\n";
print MAIL "\[Instructions\]\n";
print MAIL "SaveThis=Web Import File\n";
print MAIL "DupCheck1=Contact\n";
print MAIL "\n";
print MAIL "OnNewSendEmail=Bart,NEW,Prospect requesting information \n";
print MAIL "OnDupSendEmail=Natalie,,Duplicate Record \n";
print MAIL "\n";
print MAIL "OnNewAttachTrack=WEB Lead\n";
print MAIL "\n";
# The following is an example of testing a field for a value
#print MAIL "Below a message will be printed if the CITY is Torrance\n\n";
if ($contents{CITY} eq "Torrance") {
 print MAIL "OnAnySendEmail=Jon,WCC,This one is from Torrance\n";
 }
print MAIL "\n";
#print MAIL "Run=c:\goldmine\webimp.exe\n";
print MAIL "\n";
print MAIL "\n";
print MAIL "\[Data\]\n";
# print out general fields and values
foreach $name (sort keys %contents) {
  next if $contents{$name} eq "";
  print MAIL "$name = $contents{$name}\n";
}
print MAIL "\n";
print MAIL "\[ContSupp\]\n";

# print out profile/contsupp fields and values
foreach $name (sort keys %csarry) {
  next if $csarry{$name} eq "";
  print MAIL "$name = $csarry{$name}\n";
}
print MAIL "\n";
print MAIL "\n";

print MAIL "\n";
print MAIL "\n\n";
close (MAIL);
}

--
Regards,
Jim
----------------------------------------------------------------------------
Jim Blackburn     Warp Nine Engineering
Ph.  (858) 292-2748 3645 Ruffin Road, Suite 330
Fax (858) 292-8020 San Diego, CA 92123
http://www.fapo.com       jblackburn@fapo.com
----------------------------------------------------------------------------




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

Date: 7 Jul 2000 05:35:53 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Strip Line Feeds?
Message-Id: <slrn8mar1i.le7.efflandt@efflandt.xnet.com>

On Thu, 6 Jul 2000 11:14:01 -0700, Jim Blackburn <jblackburn@fapo.com> wrote:
>Hi,
>
>I'm using a script from a contact manager software program called Goldmine,
>where it allows users to enter data on a form on the web and the resulting
>e-mail (processed through their script) is then imported into the contact
>manager. The html form has a textfield called "Notes". The problem: if the
>person filling out the form hits the "Enter" key while entering text into
>the textfield, any additional text they enter after hitting the "Enter" key
>is not passed through. Is there a way to enter something in the script that
>would strip away the "Enter" key? Any other ideas? I'd be grateful; Goldmine
>appears to be stumped on this.

$value =~ s/(\r\n?|\n)/ /g;	# convert line endings to spaces
$value =~ s/\s*$//;		# strip whitespace from end

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Fri, 7 Jul 2000 08:22:57 -0700
From: "Jim Blackburn" <jblackburn@fapo.com>
Subject: Re: Strip Line Feeds?
Message-Id: <xBm95.1627$0x.52487@nuq-read.news.verio.net>

David,

Many thanks.

Regards,
Jim

"David Efflandt" <efflandt@xnet.com> wrote in message
news:slrn8mar1i.le7.efflandt@efflandt.xnet.com...
> On Thu, 6 Jul 2000 11:14:01 -0700, Jim Blackburn <jblackburn@fapo.com>
wrote:
> >Hi,
> >
> >I'm using a script from a contact manager software program called
Goldmine,
> >where it allows users to enter data on a form on the web and the
resulting
> >e-mail (processed through their script) is then imported into the contact
> >manager. The html form has a textfield called "Notes". The problem: if
the
> >person filling out the form hits the "Enter" key while entering text into
> >the textfield, any additional text they enter after hitting the "Enter"
key
> >is not passed through. Is there a way to enter something in the script
that
> >would strip away the "Enter" key? Any other ideas? I'd be grateful;
Goldmine
> >appears to be stumped on this.
>
> $value =~ s/(\r\n?|\n)/ /g; # convert line endings to spaces
> $value =~ s/\s*$//; # strip whitespace from end
>
> --
> David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
> http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
> http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/
>




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

Date: Fri, 07 Jul 2000 15:09:00 GMT
From: sam_hardman@my-deja.com
Subject: Stupid newbie questions.
Message-Id: <8k4rq3$ouk$1@nnrp1.deja.com>

Ok I'm trying to learn perl.  I have worked in windows and OS2 for 15
years and batch files just arn't enough anymore.  I do know 'C' and
have had basic UNIX classes about 12 years ago.  I bought some perl
books to teach me.  What I want to do is write perl scripts that are
cross platform compatable between LINUX and Windows NT.  I know this is
stupid but I'm trying to get up to speed fast, and I'm looking at about
2000 pages of books to read....:)

Questions:
1. Are the Tk libraries cross platform?
2. Where do I get the Tk libraries?

Thanks,
Sam


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 07 Jul 2000 15:33:08 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Stupid newbie questions.
Message-Id: <7a1z16lzu2.fsf@merlin.hyperchip.com>


sam_hardman@my-deja.com writes:

> Ok I'm trying to learn perl.  I have worked in windows and OS2 for 15
> years and batch files just arn't enough anymore.  I do know 'C' and
> have had basic UNIX classes about 12 years ago.  I bought some perl
> books to teach me.  What I want to do is write perl scripts that are
> cross platform compatable between LINUX and Windows NT.  I know this is
> stupid but I'm trying to get up to speed fast, and I'm looking at about
> 2000 pages of books to read....:)
> 
> Questions:
> 1. Are the Tk libraries cross platform?

Yes. You might find some exceptions here and there, but most of it is
platform independent.

> 2. Where do I get the Tk libraries?

Go to cpan.org and download it from there. If you are using ActiveState
Perl, then you can use PPM to automatically download it and install
it. Check your local copy of the docs for more info on PPM.

Also, if you need more help on Perl/Tk, then there is another newsgroup
specific for the subject. It is called comp.lang.perl.tk. You can post
there your Tk related questions.

--Ala


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

Date: Fri, 7 Jul 2000 11:28:32 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Stupid newbie questions.
Message-Id: <slrn8mbtp0.lsu.tadmc@magna.metronet.com>

On Fri, 07 Jul 2000 15:09:00 GMT, sam_hardman@my-deja.com <sam_hardman@my-deja.com> wrote:

>Ok I'm trying to learn perl.  


Another soul saved.

Very gratifying.

:-)


>I have worked in windows and OS2 for 15
>years and batch files just arn't enough anymore.  I do know 'C' and
>have had basic UNIX classes about 12 years ago.  


That surely gives you a head start from many folks who also
attempt to learn Perl (most often while *simultaneously* learning
programming in general, CGI issues, and Usenet :-)


>I bought some perl
>books to teach me.  


You should be careful.

There are *lots* of rip-off Perl books.

( which ones do you already have? )

Don't buy one unless it has been recommended by someone you trust.

There is a "Perl Books" section in Perl FAQ, part 2, which
gives a URL for book reviews.


>What I want to do is write perl scripts that are
>cross platform compatable between LINUX and Windows NT.  


   perldoc perlport


>I know this is
>stupid but I'm trying to get up to speed fast, and I'm looking at about
>2000 pages of books to read....:)


Don't forget the ~1200 pages that you get *free* with each and
every perl distribution (i.e. the standard docs).

Besides being free, they are sure to be more up-to-date than
*any* book you can buy.

The *.pod files are updated with each new release of perl.

Books are updated every few *years*...



Anything published by O'Reilly or Manning would be a safe expenditure.

( note that I have "affiliations" with both of those publishers.

  So don't count this followup as "someone you trust", though I think
  most would agree with the above anyway.
)

There are several other publishers with at least one "good" Perl book,
as well.


>Questions:
>1. Are the Tk libraries cross platform?
>2. Where do I get the Tk libraries?


Please ask Perl/Tk questions in the Perl/Tk newsgroup:


   comp.lang.perl.tk


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


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

Date: Mon, 10 Jul 2000 17:36:00 GMT
From: sam_hardman@my-deja.com
Subject: Re: Stupid newbie questions.
Message-Id: <8kd1hu$v1b$1@nnrp1.deja.com>

Thanks much for the help.

-Sam
p.s.  Will look at perl.tk news group for more info if I need it.
Thanks again.

In article <7a1z16lzu2.fsf@merlin.hyperchip.com>,
  Ala Qumsieh <aqumsieh@hyperchip.com> wrote:
>
> sam_hardman@my-deja.com writes:
>
> > Ok I'm trying to learn perl.  I have worked in windows and OS2 for
15
> > years and batch files just arn't enough anymore.  I do know 'C' and
> > have had basic UNIX classes about 12 years ago.  I bought some perl
> > books to teach me.  What I want to do is write perl scripts that are
> > cross platform compatable between LINUX and Windows NT.  I know
this is
> > stupid but I'm trying to get up to speed fast, and I'm looking at
about
> > 2000 pages of books to read....:)
> >
> > Questions:
> > 1. Are the Tk libraries cross platform?
>
> Yes. You might find some exceptions here and there, but most of it is
> platform independent.
>
> > 2. Where do I get the Tk libraries?
>
> Go to cpan.org and download it from there. If you are using
ActiveState
> Perl, then you can use PPM to automatically download it and install
> it. Check your local copy of the docs for more info on PPM.
>
> Also, if you need more help on Perl/Tk, then there is another
newsgroup
> specific for the subject. It is called comp.lang.perl.tk. You can post
> there your Tk related questions.
>
> --Ala
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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


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