Date to Day in loop

Hi All,
I have a file in the following format.I need to pick up 25th field which is a date and convert it into a day and add it as a field in the file.

"AAGENAS,PEARL L"|"S00834219"|"131186147D"|"SUP"|"600"|""|"00001236BIME"|DIAMOND|"PROVIDER|"NC|"20110824"|"733.90"|"V76.12"|"786.2"|"490"|"627.2"|""|""|""|""|"6125"|"20110827"|"20110826"|"20110826"|"N|"6125"|"Prev Rad:Bone Density(MS)"|"P"|"P"|"I"
"AARENS,MIMI"|"S00462243"|"110262446A"|"H2256"|""|""|"00001293B3IV"|DIAMOND|"PROVIDER|"C|"20111020"|"786.2"|""|""|""|""|""|""|""|""|"6120"|"20111021"|"20111021"|"20111022"|"N|"6120"|"Radiology-MF POS"|"P"|"P"|"I"
"AARENS,MIMI"|"S00462243"|"110262446A"|"H2256"|""|"GEOGRAPHIC LOCATION INCONVENIENT"|"00001293B3IV"|DIAMOND|"PROVIDER|"C|"20111020"|"786.2"|""|""|""|""|""|""|""|""|"6120"|"20111021"|"20111021"|"20111021"|"N|"6120"|"Radiology-MF POS"|"P"|"P"|"I"

I have the code which converts date to day in perl, but not sure how to put this in the loop.

perl -e '
		use POSIX qw(strftime);
		$fmt = "%A";  # %a = abbreviated weekday %u = weekday number	
		$mday = substr("$ARGV[0]", 6, 2);
		$mon =  substr("$ARGV[0]", 4 ,2);
		$year = substr("$ARGV[0]", 0 ,4);
		$weekday =
		  strftime($fmt, 0, 0, 0, $mday , $mon - 1, $year - 1900, -1, -1, -1);
		print "$weekday";
		' 20110827

Also since the file has thousands of records , I am not sure if perl is the right way to go.

Any help will be appreciated.

Desired format of the file

"AAGENAS,PEARL L"|"S00834219"|"131186147D"|"SUP"|"600"|""|"00001236BIME"|DIAMOND|"PROVIDER|"NC|"20110824"|"733.90"|"V76.12"|"786.2"|"490"|"627.2"|""|""|""|""|"6125"|"20110827"|"20110826"|"20110826"|"Friday"|"N|"6125"|"Prev Rad:Bone Density(MS)"|"P"|"P"|"I"
"AARENS,MIMI"|"S00462243"|"110262446A"|"H2256"|""|""|"00001293B3IV"|DIAMOND|"PROVIDER|"C|"20111020"|"786.2"|""|""|""|""|""|""|""|""|"6120"|"20111021"|"20111021"|"20111022"|"Saturday"|"N|"6120"|"Radiology-MF POS"|"P"|"P"|"I"
"AARENS,MIMI"|"S00462243"|"110262446A"|"H2256"|""|"GEOGRAPHIC LOCATION INCONVENIENT"|"00001293B3IV"|DIAMOND|"PROVIDER|"C|"20111020"|"786.2"|""|""|""|""|""|""|""|""|"6120"|"20111021"|"20111021"|"20111021"|"Friday"|"N|"6120"|"Radiology-MF POS"|"P"|"P"|"I"

You can use perl's <> operator to read each line from stdin into perl's builtin $_ variable...then parse $_ to extract the fields and process them as required.

while (<>) {
    # parse $_
    ...
    # process the extracted fields
    ...
}

Thanks shamrock! Is there a way of doing this in shell or awk since its thousands of records in the file.

Even using the shell or awk to do this you will have to process 1 line at a time...there is no way around that...besides i'd prefer perl for date time math.