[23963] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6164 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 19 11:05:50 2004

Date: Thu, 19 Feb 2004 08:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 19 Feb 2004     Volume: 10 Number: 6164

Today's topics:
    Re: can s/// return a new value, rather than modifying  <nobull@mail.com>
    Re: finding the last match before a first match (regex) <gregfcarlson@hotmail.com>
    Re: html <tadmc@augustmail.com>
    Re: html <paul.cooper@Nobasspam.ac.uk>
    Re: html <matthew.garrish@sympatico.ca>
    Re: I wish buy Perl book <gp@nospm.hr>
        map, for, and while <jill_krugman@yahoo.com>
    Re: method reference - repost (Anno Siegel)
    Re: Multiple substitution in a complex RE (SqlSlinger)
    Re: Multiple substitution in a complex RE (SqlSlinger)
    Re: Multiple substitution in a complex RE <fifo@despammed.com>
    Re: newbie: inheritance (Anno Siegel)
    Re: newbie: inheritance (Randal L. Schwartz)
    Re: regex <tadmc@augustmail.com>
    Re: Replacing a text in multiple files with regular exp <matthew.garrish@sympatico.ca>
    Re: Replacing a text in multiple files with regular exp (Angel)
    Re: Replacing a text in multiple files with regular exp <jurgenex@hotmail.com>
    Re: Replacing all "special characters" with code <tore@aursand.no>
        Tie a file to a hash <gkincade1@austin.rr.com>
        Unexpected chomp() results <exide@comcast.net>
    Re: Unexpected chomp() results <jill_krugman@yahoo.com>
    Re: Unexpected chomp() results <exide@comcast.net>
    Re: Unexplained output for PERL print statement <tadmc@augustmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 19 Feb 2004 12:38:16 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: can s/// return a new value, rather than modifying it's input argument?
Message-Id: <u9u11ndz2f.fsf@wcl-l.bham.ac.uk>

Uri Guttman <uri@stemsystems.com> writes:

> >>>>> "BM" == Brian McCauley <nobull@mail.com> writes:
> 
>   BM> Secondly I think it makes more sense for &apply to work in a list
>   BM> context too.
> 
>   BM> sub apply (&@) {
>   BM>     my $action = shift;
>   BM>     &$action for my @values = @_;
>   BM>     wantarray ? @values : $values[-1];
>   BM> }
> 
> why do you return the last element of @values in scalar context?
> wouldn't the first be just as arbitrary?

There is, as you know, no general way to infer from the behaviour of
EXPR in a list context how EXPR will behave in a scalar context.

One of the many possible behaviours is for scalar(EXPR) to be
equivalent to (EXPR)[0] and another is for it to be equivalent to
(EXPR)[-1].

Now it happens that in Perl, for EXPRs where one of the above is true,
the second one is more common.  Once I have decided that I want my
apply() function to do one of the above then it makes sense to choose
the one that is more common.

> why not check for the number of arguments passed in as well?

Because conceptually the function takes two arguments, the second one
being a LIST.  I considered thay I should carp() (or even croak()) if
called in a scalar context with a list of length other than one.  But
I decided the cost was warranted.  If and when I ever get a round tuit
the XS version of apply() will do so.

>     $action->() for my @values = @_;
> #i like that syntax better for calling code refs

As you know, because we've discussed it before, I prefer to use &{}
when I'm calling a coderef where I'm expecting the called code to
communicate with the caller via shared globals (in this case $_).

I prefer to use ->() where I'm expecting the called code to
communicate with the caller via the formal arguments and return value.

> 	return @values if wantarray ;
> 	return \@values if @_ > 1 ;
> 	return $values[0] ;

I think having the return value change type based on the length of the
list is conceptually ugly and more importantly a bug waiting to happen.

Consider:

  my $foo = apply { s/this/that/ } @bar;

I'm either expecting $foo to contain an arrayref or I'm not.  I
certainly don't expect it to be dependant on $#bar!

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 19 Feb 2004 16:01:13 GMT
From: "Greg Carlson" <gregfcarlson@hotmail.com>
Subject: Re: finding the last match before a first match (regex)
Message-Id: <d55Zb.13848$4o.33792@attbi_s52>

"Brian McCauley" <nobull@mail.com> writes:

> Please put the subject of your post in the Subject of your post....

Oops. I see your point.

> If 'a' really is a single character then see other response.
>
> Otherwise I'd usually use...
>
>   /(.*)(a.*foo)/
>
> Note this actually matches both everything before the desired target
> and the desired target.  Note also this finds the last 'a' before the
> _last_ 'foo'.

That makes sense. So how would I find the last 'a' before the _first_ 'foo'?
My latest attempt is:

$tmp = 'abcdefgabcdefgfooabcdefgfoo';
$tmp =~ m/(foo)/ogcs;
[do stuff with $1]   # this part works as I'd hoped
$tmp = substr($tmp, 0, pos($tmp));
$tmp =~ m/.*(a).+?$/os;

But that still got the first 'a'. Also, $tmp can be rather large so the
substr is a bit distasteful. Is there any way to search backward from the
current pos or something similar? Thanks again.

Greg Carlson




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

Date: Thu, 19 Feb 2004 06:35:15 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: html
Message-Id: <slrnc39bc3.3io.tadmc@magna.augustmail.com>

prabs <prabals_r@yahoo.com> wrote:

> how to hide html source code?


Why do you think that you need to hide HTML source code?


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


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

Date: Thu, 19 Feb 2004 13:57:27 +0000
From: Paul Cooper <paul.cooper@Nobasspam.ac.uk>
Subject: Re: html
Message-Id: <b3g930lbr5eptadc32seikavgib7b050l9@4ax.com>

On Thu, 19 Feb 2004 02:40:03 -0600, "prabs" <prabals_r@yahoo.com>
wrote:

>how to hide html source code?


You can't, and this is OT. All HTML has to be downloaded to a client
browser to be of any use, and is therefore completely accessible to
the client machine. The only way to keep HTML invisible is to keep it
off the web.


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

Date: Thu, 19 Feb 2004 08:57:20 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: html
Message-Id: <2h3Zb.6518$w65.603957@news20.bellglobal.com>


"prabs" <prabals_r@yahoo.com> wrote in message
news:07f5e7cdd8a47e6c09487eeece6ec6b2@localhost.talkaboutprogramming.com...
>
> how to hide html source code?
>

Copy it to a diskette; erase all traces of the file from your hard drive;
and then place the diskette somewhere where no one will ever suspect.

Matt




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

Date: Thu, 19 Feb 2004 16:14:54 +0100
From: "PHP2" <gp@nospm.hr>
Subject: Re: I wish buy Perl book
Message-Id: <c12js3$qf2$1@ls219.htnet.hr>

thanks

"PHP2" <gp@nospm.hr> wrote in message news:c10oc7$rjd$1@ls219.htnet.hr...
> I wish buy Perl book tomorrow by Amazon.. I am new in Perl development..
>
> Pls. send to me advices..
>
>




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

Date: Thu, 19 Feb 2004 15:13:42 +0000 (UTC)
From: J Krugman <jill_krugman@yahoo.com>
Subject: map, for, and while
Message-Id: <c12jr6$8np$1@reader2.panix.com>





With map, one can streamline for-loops like this one:

  my @array_2;
  push @array_2, some_sub($_) for @array_1;

into a single assignment:

  my @array_2 = map some_sub($_), @array_1;

Is there a way (not necessarily using map) to streamline while-loops
like this one:

  my @array;
  push @array, some_other_sub() while some_condition();

into a single assignment to @array?

TIA!

jill




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

Date: 19 Feb 2004 13:32:00 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: method reference - repost
Message-Id: <c12dsg$j22$2@mamenchi.zrz.TU-Berlin.DE>

Uri Guttman  <uri@stemsystems.com> wrote in comp.lang.perl.misc:
> >>>>> "NS" == Neil Shadrach <neil.shadrach@corryn.com> writes:

[...]

>   NS> $o->$m( 20 );
> 
>   NS> calls the method for the instance $o
> 
>   NS> how could it be called without creating the intermediate $m ?
> 
> can't be done. it has nothing to do with how you get the dynamic
> method. the method slot of a call must be a single scalar variable or
> bareword. it can't be an expression.

Well, it can, but the expression would have to return a coderef, not the
method name.  I don't think that is what the OP had in mind.

Anno


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

Date: 19 Feb 2004 05:37:09 -0800
From: vince.iacoboni@db.com (SqlSlinger)
Subject: Re: Multiple substitution in a complex RE
Message-Id: <b74d9c54.0402190537.24658abb@posting.google.com>

Glenn, Uri, John, 

Excellent suggestions all!  

Now here's the rest of what I should have told you.  I use Perl every
chance I get, but in this case I'm hoping to program a macro in
TextPad to perform this kind of substitution.  TextPad REs support
most of the Perl RE features, but not the g (global) modifier and not
loops.  This is why I was attempting to get it all done in the s///
statement.  If it won't work, of course, I can program a quick perl
script to do it using any of your suggestions, but that's slightly
more inconvenient than the TextPad macro.

For my own info, is there any way to get a repeated outer grouping in
the pattern to replace while referencing (and modifying) the inner
grouping in the replace string?


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

Date: 19 Feb 2004 05:53:21 -0800
From: vince.iacoboni@db.com (SqlSlinger)
Subject: Re: Multiple substitution in a complex RE
Message-Id: <b74d9c54.0402190553.1b96ab1b@posting.google.com>

Uri Guttman <uri@stemsystems.com> wrote in message news:<x7vfm4utep.fsf@mail.sysarch.com>...
> >>>>> "GJ" == Glenn Jackman <xx087@freenet.carleton.ca> writes:
> 
> 
>   GJ>   my @vars = qw(VARIABLE_ONE VARIABLE_NUMBER_TWO
>   GJ>   a_really_long_VARIABLE_name);
> 
>   GJ>   foreach (@vars) { 
>   GJ>       my $var = ucfirst lc; 
>   GJ>       $var =~ s/_(.)/\U$1/g; 
>   GJ>   }
> 
> 	s/_?(.)([^_]*)/\U$1\L$2/g ;
> 
> uri

Nice and compact, but doesn't isolate only variables containing an
underscore.  If run against a source file, would match any word,
right?

Vince


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

Date: Thu, 19 Feb 2004 14:33:45 +0000
From: fifo <fifo@despammed.com>
Subject: Re: Multiple substitution in a complex RE
Message-Id: <20040219143341.GA14410@fleece>

At 2004-02-19 05:37 -0800, SqlSlinger wrote:
> Now here's the rest of what I should have told you.  I use Perl every
> chance I get, but in this case I'm hoping to program a macro in
> TextPad to perform this kind of substitution.  TextPad REs support
> most of the Perl RE features, but not the g (global) modifier and not
> loops.  This is why I was attempting to get it all done in the s///
> statement.  If it won't work, of course, I can program a quick perl
> script to do it using any of your suggestions, but that's slightly
> more inconvenient than the TextPad macro.
> 

If you need a single substitution to work over the entire file, how
about doing something like

  s/                   ([a-zA-Z0-9])([a-zA-Z0-9]*)(?=_[a-zA-Z0-9_])
   | (?<=[a-zA-Z0-9_]_)([a-zA-Z0-9])([a-zA-Z0-9]*)
   /\U$1$3\L$2$4/xg


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

Date: 19 Feb 2004 13:17:17 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: newbie: inheritance
Message-Id: <c12d0t$j22$1@mamenchi.zrz.TU-Berlin.DE>

Andrew V. Tkachenko <pobugfix@peterlink.ru> wrote in comp.lang.perl.misc:
> Thanks for your reply, Anno.
> 
> I'm still confused with this thing.
> 
> 
> Anno Siegel wrote:
> > Andrew V. Tkachenko <pobugfix@peterlink.ru> wrote in comp.lang.perl.misc:
> > 
> >>Hello.
> >>I'm a bit confused with the following problem:
> >>
> >>Lets pretend that I have three modules:
> > 
> > 
> > [lots of code snipped]
> > 
> > Please reduce your problem to a small example.  You presented much more
> > code than most people will want to read in a usenet posting.
> 
> Ok, in a short terms:

I am still not sure what you want to accomplish.

> 1. I have base class myDaemon;
> 
> myDaemon
> 
> wich has dumb method 'send_request':
> 
> sub myDaemon::send_request {}
> 
> and non-empty 'request' method:
> 
> sub myDaemon::request {}
> 
> 2. I have two classes wich inherit myDaemon class:
> 
> myDaemon::Socket::INET
> myDaemon::Socket::UNIX;
> 
> each class define its own 'send_request' method
> 
> sub myDaemon::Socket::INET::send_request {}
> sub myDaemon::Socket::UNIX::send_request {}
> 
> 
> 3. I can get an instance of myDaemon using either calling
>
> myDaemon::Socket::INET->new
> or
> myDaemon::Socket::UNIX->new

This doesn't look right.  The new() method should always return an object
of the class it is called from and not "know better" and supplant another.

So "myDaemon::Socket::INET->new" should return an object in class
"myDaemon::Socket::INET" and "myDaemon::Socket::UNIX->new" should return
an object in "myDaemon::Socket::UNIX".

> 4. I have another class: myLogDaemon wich inherits from myDaemon and 
> overrides its 'request' method

So you introduce a third class that also inherits from myDaemon.  That
isn't going to change the behavior of the other classes
(myDaemon::Socket::INET and myDaemon::Socket::UNIX) that already inherit
from it.  They don't even know about the new class.

You may have better chances when you turn things around.  Write a generic
class myDaemon::Basic that does everything except the logging.  Then
create a class myDaemon that (at first) inherits everything from
myDaemon::Basic, and make *that* a base class of myDaemon::Socket::INET
and myDaemon::Socket::UNIX.

Now you can extend the functionality of myDaemon beyond that of
myDaemon::Basic by overriding the corresponding methods in myDaemon.

Anno


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

Date: Thu, 19 Feb 2004 15:07:33 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: newbie: inheritance
Message-Id: <0030f2dfcb1fd1b51792e9c506a624a3@news.teranews.com>

>>>>> "Andrew" == Andrew V Tkachenko <pobugfix@peterlink.ru> writes:

Andrew>      my $proto = shift;
Andrew>      my $class = ref($proto) || $proto;

Please don't do this.
<http://www.perlmonks.org/index.pl?node_id=52089>

print "Just another Perl hacker,"
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Thu, 19 Feb 2004 06:39:58 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: regex
Message-Id: <slrnc39bku.3io.tadmc@magna.augustmail.com>

yamini <yamini_rajan@nospam.com> wrote:

>  $tag="({NP_PP}|{NP_B})";
>
> $_="{NP_PP} kinase{/NP_PP} citron {NP_B}tyrosine{/NP_B}";
> 
> will $tag match both the specified patterns?


What happened when you tried it?


What patterns? There are no pattern matches in your code...


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


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

Date: Thu, 19 Feb 2004 09:02:15 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Replacing a text in multiple files with regular expressions
Message-Id: <Fl3Zb.6519$w65.604343@news20.bellglobal.com>


"Angel" <anichin@vip.bg> wrote in message
news:8732d910.0402190049.3933532a@posting.google.com...
> I would like to make an image clickable, in other words
> to replace all occurrences of:
>
> <img src="pic.gif" width="199" height="31" alt="" border="0">
>
> with
>
> <a href="http://somewhere.com"><img src="pic.gif" width="199"
> height="31" alt="" border="0"></a>
>
> I would like to search and replace on many files located in
> different subfolders of one main folder.
>
> I know it should be possible using regular expressions but
> all my attempts failed. Can anyone help me ?
>

If you want to make *all* the images clickable (and none of them already
are), you could try something like:

$html =~ s#(<img[^>]+>)#<a href="http://somewhere.com">$1</a>#gis;

That said, regexes are not the best way to deal with markup languages, as
you no doubt are finding out. You're better off taking a look at one of the
html parsing modules.

Matt




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

Date: 19 Feb 2004 07:35:33 -0800
From: anichin@vip.bg (Angel)
Subject: Re: Replacing a text in multiple files with regular expressions
Message-Id: <8732d910.0402190735.2a77c469@posting.google.com>

anichin@vip.bg (Angel) wrote in message news:<8732d910.0402190049.3933532a@posting.google.com>...
> I would like to make an image clickable, in other words
> to replace all occurrences of:
> 
> <img src="pic.gif" width="199" height="31" alt="" border="0">
> 
> with
> 
> <a href="http://somewhere.com"><img src="pic.gif" width="199"
> height="31" alt="" border="0"></a>
> 
> I would like to search and replace on many files located in 
> different subfolders of one main folder.
> 
> I know it should be possible using regular expressions but
> all my attempts failed. Can anyone help me ?
> 
> Thanks.

The problem was not the regular expression itself but
the need to process many files and recursively to search
the sub-folders.

I tried something similar to:

perl -pi.bak -e "s#(<img[^>]+>)#<a href="http://somewhere.com">$1</a>#gi" *.html

The problem is that wildcards does not work with my 
perl on Windows XP. I am not sure if it works in Unix either.

Luckily I found a perl script that does exactly what I need.
You can find it here:

http://peter.verhas.com/progs/perl/prep/

Thanks Verhás Péter :-)

The link to download the script is at the end of the page.


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

Date: Thu, 19 Feb 2004 16:01:21 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Replacing a text in multiple files with regular expressions
Message-Id: <l55Zb.27814$5W3.6744@nwrddc02.gnilink.net>

Angel wrote:
> anichin@vip.bg (Angel) wrote in message
> news:<8732d910.0402190049.3933532a@posting.google.com>...
>> I would like to make an image clickable, in other words
>> to replace all occurrences of:
>>
>> <img src="pic.gif" width="199" height="31" alt="" border="0">
>>
>> with
>>
>> <a href="http://somewhere.com"><img src="pic.gif" width="199"
>> height="31" alt="" border="0"></a>
>>
>> I would like to search and replace on many files located in
>> different subfolders of one main folder.
>>
>> I know it should be possible using regular expressions but
>> all my attempts failed. Can anyone help me ?
>
> The problem was not the regular expression itself but
> the need to process many files and recursively to search
> the sub-folders.

Then why didn't you say so in the beginning?
And btw., no it is not possible to recurse through a directory structure
using REs. Those two have nothing to do with each other.

> I tried something similar to:
>
> perl -pi.bak -e "s#(<img[^>]+>)#<a
> href="http://somewhere.com">$1</a>#gi" *.html
>
> The problem is that wildcards does not work with my
> perl on Windows XP. I am not sure if it works in Unix either.

The proper way is to use File::Find
It will recurse through any directory structure, visiting any file on the
way.
Then it is up to you to do whatever you want to for each file.

jue




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

Date: Thu, 19 Feb 2004 15:11:09 +0100
From: Tore Aursand <tore@aursand.no>
Subject: Re: Replacing all "special characters" with code
Message-Id: <pan.2004.02.19.14.05.57.277998@aursand.no>

On Wed, 18 Feb 2004 19:32:06 -0800, Mike wrote:
> I'm currently changing all of my "special characters," like &, ",
> whitespace, etc to their HTML counterparts manually (&amp; &quot;
> $nbsp;). The problem is, there could be several that I'm forgetting. Is
> there a faster way to transfer all of these characters at once?

Take a look at HTML::Entities.  Maybe not faster, but at least you get to
have all the characters encoded correctly.


-- 
Tore Aursand <tore@aursand.no>
"The purpose of all war is ultimately peace." -- Saint Augustine


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

Date: Thu, 19 Feb 2004 15:12:51 GMT
From: "SpecialK" <gkincade1@austin.rr.com>
Subject: Tie a file to a hash
Message-Id: <Tn4Zb.9825$jl.3938@fe2.texas.rr.com>

Does anyone know how to tie a large file to a hash without using shared
memory?
I  know I can use Tie::File to tie the file to an array and from the array
create a hash, but I need something that is much faster than that?

thanks,
gregk




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

Date: Thu, 19 Feb 2004 07:31:25 -0800
From: Exide Arabellan <exide@comcast.net>
Subject: Unexpected chomp() results
Message-Id: <zvGdnfSaLpVWS6ndRVn-sA@comcast.com>

Greetings,

	In the following code im trying to remove the ending newline (\n) from 
$login_attempt and print it to $client.

---
  1. #! /usr/bin/perl -w
  2.
  3. use strict;
  4. use IO::Socket;
  5.
     #.. declaring variables and printing local info to <STDOUT> ..
28.
29. while (my $client = $server->accept()) {
30.	$client->autoflush(1);
31.	print $client "username: ";
32.	while (<$client>) {
33.		my $login_attempt;
34.		$login_attempt = $_;
35.		chomp($login_attempt);
36.		print $client "Account '".$login_attempt."' does not exist. Please 
try again.";
37.	}
38. }
---

Returns:
' does not exist. Please try again.

Instead of:
Account 'foo' does not exist. Please try again.

I tried writing a simple test script using lines 33-36 (replacing $_ 
with <STDIN> on line 35) and it worked as i had expected. Any thoughts?

Ryan Zander
www.arabellan.com



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

Date: Thu, 19 Feb 2004 15:46:56 +0000 (UTC)
From: J Krugman <jill_krugman@yahoo.com>
Subject: Re: Unexpected chomp() results
Message-Id: <c12lpg$98n$1@reader2.panix.com>

In <zvGdnfSaLpVWS6ndRVn-sA@comcast.com> Exide Arabellan <exide@comcast.net> writes:

>Greetings,

>	In the following code im trying to remove the ending newline (\n) from 
>$login_attempt and print it to $client.

>---
>  1. #! /usr/bin/perl -w
>  2.
>  3. use strict;
>  4. use IO::Socket;
>  5.
>     #.. declaring variables and printing local info to <STDOUT> ..
>28.
>29. while (my $client = $server->accept()) {
>30.	$client->autoflush(1);
>31.	print $client "username: ";
>32.	while (<$client>) {
>33.		my $login_attempt;
>34.		$login_attempt = $_;
>35.		chomp($login_attempt);
>36.		print $client "Account '".$login_attempt."' does not exist. Please 
>try again.";
>37.	}
>38. }
>---

>Returns:
>' does not exist. Please try again.

>Instead of:
>Account 'foo' does not exist. Please try again.


What do you get if you print $login_attempt before chomping it?

jill



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

Date: Thu, 19 Feb 2004 07:53:18 -0800
From: Exide Arabellan <exide@comcast.net>
Subject: Re: Unexpected chomp() results
Message-Id: <KZWdnUPMwrd3RqndRVn-hQ@comcast.com>

J Krugman wrote:

> 
> What do you get if you print $login_attempt before chomping it?
> 
> jill
> 

Account 'foo
' does not exist. Please try again.



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

Date: Thu, 19 Feb 2004 07:01:52 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Unexplained output for PERL print statement
Message-Id: <slrnc39cu0.3io.tadmc@magna.augustmail.com>

Scott Bryce <sbryce@scottbryce.com> wrote:

> Chomp removes all trailing 
                ^^^
                ^^^ no it doesn't
> newline characters.


chomp() removes whatever is in $/ (apart from
the special "paragraph mode").

If $/ = "\n" (the default), then chomp() removes ONE trailing 
newline character.

If its argument is an array, chomp() removes ONE trailing
newline character from each array element.


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


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

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 V10 Issue 6164
***************************************


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