while () { chomp; $_ =~ s/^&(\w+)([\(\)]*)/$1()/; print "$_\n"; } __DATA__ &foobar &foobar() foobar() &foobar("asdf")