"Chas. Owens" writes:
> I believe you want either [Text::Wrap][1] (which has been a part of
> the core since Perl 5.2):
Nice... yes I wish I'd known about this tool some time ago... thanks
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners
On Sun, Jul 26, 2009 at 17:59, John W. Krahn wrote:
> Bryan Harris wrote:
snip
>> Oddly, perl won't let me do "my ($_) = shift;", so I'm stuck having to use
>> another variable.
>
> Perl 5.10 *will* let you do "my $_".
snip
Be warned that you may reveal bugs if you use make $_ lexical:
#!/usr/bin
On Sun, Jul 26, 2009 at 17:37, Harry Putnam wrote:
> I'm a little lost even what to look for to do this.
>
> With a variable like this:
>
> $var = 'American Express offers individuals online access to its world-class
> Card, Financial, and Travel services, including financial advice, retirement
>
Bryan Harris wrote:
Is it not possible to use $_ in subroutines?
Yes it is, just not the way you seem to want to use it.
For example, my temptation was to do this:
**
sub isDate {
$_ = shift;
if (m!\d{2}/\d{2}/\d{2}!) { return 1; }
else { re
I'm a little lost even what to look for to do this.
With a variable like this:
$var = 'American Express offers individuals online access to its world-class
Card, Financial, and Travel services, including financial advice, retirement
planning, air and hotel reservations and more'
I never know h
Bryan Harris wrote:
... but by modifying $_ I was clobbering $_ elsewhere in the larger program!
Oddly, perl won't let me do "my ($_) = shift;", so I'm stuck having to use
another variable.
Why can't we do that? Is using $_ in subroutines discouraged??
The use of $_ in subroutines is discour
Is it not possible to use $_ in subroutines?
For example, my temptation was to do this:
**
sub isDate {
$_ = shift;
if (m!\d{2}/\d{2}/\d{2}!) { return 1; }
else { return 0; }
}
**
... but by modifying $_ I
Harry Putnam wrote:
The regex (\"uri\".*?) Doesn't match at all so I would expect the $2
to return ''. But instead it appears to return the whole line.
No, the regex doesn't match anything so there is no substitution. $line
is unmodified.
--
Just my 0.0002 million dollars worth,
I'm miss understanding something basic about the numbered values like
$1 $2 in a s/// operation.
In this script... I don't understand why $line has the value it does
when the $2 paren enclosed regex does not match anything.
#!/usr/local/bin/perl
use strict;
use warnings;
my $line;