Owen wrote:
> 
> On Sat, 21 Feb 2004 21:23:13 -0600
> Perl Mail User <[EMAIL PROTECTED]> wrote:
> 
> I think you need to change
> 
> >         foreach ($line) {
> >             @lines = $line;
> 
> to
> 
> push(@lines,$line);
> 
> Your foreach loop is in the inner most loop, so your @lines is only going
> to be the last line, though the systax is improper.

There is nothing wrong with the syntax or perl would report a syntax
error.  The idiom 'foreach ($scalar) {}' is very useful in perl. 
Instead of:

$scalar = lc $scalar;
$scalar =~ tr/_//d;
$scalar =~ s/\s+/ /g;
$scalar =~ s/(\w+)/\u\L$1/g;

You can do this:

foreach ( $scalar ) {
    $_ = lc;
    tr/_//d;
    s/\s+/ /g;
    s/(\w+)/\u\L$1/g;
    }



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to