Nooooo! :) See
Death to dot star to read why
.* is bad.
You can't use
\1 there, you should just use
1.
Please note that
/^1/ will also match strings beginning with
123.
I suggest the following solution:
$line =~ s/$/,P/ if /^1\D/;
Which will substitute the end of the line (which is _before_ a newline if there is any) with
,P (and thus "append" it) if the line starts with
1 followed by anything-that-is-not-a-digit.
2;0 juerd@ouranos:~$ perl -e'undef christmas'
Segmentation fault
2;139 juerd@ouranos:~$