in reply to Re: Strip first name from string
in thread Strip first name from string

While I agree with your statement that ..The trouble with this sort of problem statement is that it is subject to all kinds of counter-exemplification I will want to second toolic mention of Lingua::EN::NameParse.

And for a one off name like you mentioned one could do this:

print sprintf 'Mr. %3$s' => split/ / => "G. Gordon Liddy Sr., PhD"; #M +r. Liddy

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Replies are listed 'Best First'.
Re^3: Strip first name from string
by hippo (Archbishop) on Jan 29, 2014 at 09:17 UTC

    While I understand what the fat commas are doing in there (I think), it's more perplexing why you used print sprintf instead of just printf. What am I missing here?

      FWIW , usually, when one goes the more verbose route in posts, its to help the noobs, for example
      my $foo = sprintf ...; print "$foo\n";

      So  print sprintf ...

      Its kinda like using qq{} and q{} for oneliners --- makes the readers life more copy/paste and less editing :)

      Just my impression

      hi hippo,
      ..it's more perplexing why you used print sprintf instead of just printf. What am I missing here?..

      Apart from printf doc. stating that printf and print sprintf(FORMAT, LIST) are equivalent. Atleast it's obvious from the usage of sprintf that one wants a formatted string.

      If you tell me, I'll forget.
      If you show me, I'll remember.
      if you involve me, I'll understand.
      --- Author unknown to me