Re: using regex, how to erase off all blank spaces

2008-04-06 Thread Dr.Ruud
[EMAIL PROTECTED] schreef: > use strict; > use warnings; > > open (MYDATAS , " my @datas = ; > close MYDATAS; > > foreach (@datas){ > s/^\s*$//; > } > > open (WRITEDATAS, ">testing.txt") || die $!; > print WRITEDATAS @datas; > close WRITEDATAS; That looks a lot like Perl 4. Study this: #!/usr

Re: using regex, how to erase off all blank spaces

2008-04-05 Thread Jeff Pang
On Sun, Apr 6, 2008 at 11:17 AM, John W. Krahn <[EMAIL PROTECTED]> wrote: > > Your problem is that the line "123\n" does not match the pattern /^\s*$/. > Try it using two substitutions like this: > > s/^\s+//; > > s/\s+$//; or use one, s/^\s+|\s+$//g; -- To unsubscribe, e-mail: [EMAIL

Re: using regex, how to erase off all blank spaces

2008-04-05 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi, Hello, The script below is suppose to erase off, from a file, all blank lines including newlines, I wrote the regex is as follows : s/^\s*$//; however after running the script, a last newline remains. Can someone explain why the regexp can erase off all newlines