in reply to Strip data from end of an element of an array
# make array print properly $"="\t" # assuming this while loop goes through file while (<INFILE>) { # these should remove line changes chomp; s/\r$//o; # split and clean $line[0] my @line=split (/\t/,$_); $line[0]=~s/^"|"$//go; # get the aliases from line[4] # $1 should be aliases and word 'alias:' is removed $line[4]=~s/(?:alias:)? ([\d\s,]+)"$/$1/o; # place things back and add $line[0] $line[4].="alias: $1, $line[0]\""; # get the new alias and place it $new_alias my $new_alias; $line[0]="\"$new_alias\""; # assuming we want newline use this, change "\n" if want different print OUTFILE "@line\n" }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Strip data from end of an element of an array
by davido (Cardinal) on Nov 14, 2003 at 16:38 UTC | |
by Roger (Parson) on Nov 14, 2003 at 23:56 UTC |