Susan Aurand wrote:
> 
> I have been writing Perl code for (1) week as of  today. Thanks to the
> beginner user e:mail, and thank you to John Edwards, and
> [EMAIL PROTECTED], and other input I have learned from this page. I have
> put togther the following. It works well, and is doing what I want it to
> do. Except, 1 little problem remains. Please read the below, and I would
> appreciate any advice.
> I have tried trim and chomp with no results.
> Thank You Susan. (P.S. - I am not a student - I work in the ITC
> department.)
> 
> This routine opens 15 different school files, for this example, I have
> shorten it to 1 school. It creates a data file
> call STNAME.DAT. This file contains, last name, first name, student #,
> and school #. I then open STNAME, look for
> duplicates using ( first 5 char's of last name+1 char of first name).
> Look in arrary does it exist. if yes, add a counter to name.
> I then store this in a result file, called result.dat. What my question
> is, how do I strip out the spaces on the last name if the last
> name is not 5 char. long. example: ASHE J      123456  396.
> 
> Example:  open(FILE396,"396.TXT") or die $!;  # open file for input
> SCHOOLS INDIV. FILE
>              print OUT
>     substr($_,12,5),substr($_,30,1),substr($_,3,9),"
> ",substr($_,0,3),"\n"
>       while <FILE396>;

print OUT (unpack 'a3 a9 A5 x13 a1', $_)[2,3,1,0], "\n" while <FILE396>;


>          close(FILE396);
> 
> # CREATE result file, look for duplicates add counter on name, rebuild
> string
> 
> [snip]
> 
> # The file below is results.dat  (if last name is less than 5 chars. it
> fille in spaces. I want the spaces gone)
> 
> [snip]


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to