also keep open and close outside the loop.
you overwriting previously written lines.

open FILE2,"$file";
foreach @lines
{
print FILE2 $_;
}
close FILE2

cheers

On 1/18/07, Mathew <[EMAIL PROTECTED]> wrote:
Thanks.  That likely will help.  However, I still can't even get it to
perform any action.  I have it set to print to the screen right now but
it isn't creating any output.

Mathew

Guerrero, Citlali (GE, Corporate, consultant) wrote:
> Hi Mathew :
>
>     This is what your regexp ($line =~ s/^.*\s//g;)means :  Remove any
> kind of character follow by ONE SPACE at the BEGINNING  of the string,
> and you are right it do not do what you want.
>     If I understand right what you want to do is preserve the name of
> the subfolder, if that is correct then you may need this regexp:
>
>       $line =~ s/.*[\s+\t+](\w+)/$1/
>
> this regexp does : Remove any character follow by : one or more spaces
> or one or more tabs, follow by one or more words(check the perldoc if
> you do not know the meaning of  \w) and all this patron replace it with
> $1 which is the (\w+) and should be(according to your example) =A
> Perfect Circle
>
>     I hope it help =D
>     But if you have any questions I kindly suggest you to take a look at  :
>
> http://www.troubleshooters.com/codecorn/littperl/perlreg.htm
> or
> http://www.perl.com/doc/manual/html/pod/perlre.html
>
> Cheers
> Mathew escribió:
>> I have a file with a list of subfolders.  The list was created using dir
>> and each entry is like thus:
>>
>> 12/12/2005  04:38 AM    <DIR>          A Perfect Circle
>>
>> I then created a simple script that I hoped would eliminate everything
>> prior to the last bit of text which follows the big space.
>>
>> open FILE, "H:\My Music\folderlist.txt";
>>
>> foreach my $line (readline FILE) {
>>     $line =~ s/^.*\s//g;
>>         open FILE2, "H:\My Music\artists.txt";
>>         print FILE2 $line . "\n";
>>         close FILE2;
>> }
>>
>> close FILE;
>>
>> Not only do I think the regex is very wrong, but it isn't doing
>> anything.  If I had to guess, it is saying to replacy everything up to
>> the first space with nothing.  While this isn't what I want it to do,
>> having it do that would probably be a good step in the right direction.
>>  However, it won't even do that.
>>
>> What am I doing wrong here?
>>
>> Mathew
>>
>>
>>
>
>
>
>


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




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


Reply via email to