[lug] perl question

Stephen Queen svq at peakpeak.com
Sat Apr 27 15:53:44 MDT 2002


>
>
> and so on....this way i can add a"#" to the begging of $newarray[0]
> so ms word will be cool when i mailmerg this list so word can make mailing
> labes...and so i can easily pattern match against users first names on
> returned mail.
>

To add a # at the beginning of the first line try

foreach  $array (@array) {
        print "$array\n";
        $array=~s/^/#/;
        print "$array\n";
}

To add a # at the beginning of every line try
foreach  $array (@array) {
        print "$array\n";
        $array=~s/^/#/gm;
        print "$array\n";
}

Hope that helps.

Steve Queen





More information about the LUG mailing list