in reply to Re: Why is print output different for function returning an array versus printing an array variable?
in thread Why is print output different for function returning an array versus printing an array variable?

michael@x054:[/data/prj/labserv/perftools/perl]cat *2.pl @coins = ("Quarter","Dime","Nickel"); print "@coins"; print "\n\r"; print sort(@coins); print "\n\r"; michael@x054:[/data/prj/labserv/perftools/perl]perl *2.pl Quarter Dime Nickel DimeNickelQuarter

Confused again. I seem to getting the opposite of what you said should happen. "@coins" is separated while sort(@coins) is not.

  • Comment on Re^2: Why is print output different for function returning an array versus printing an array variable?
  • Download Code

Replies are listed 'Best First'.
Re^3: Why is print output different for function returning an array versus printing an array variable?
by aixtools (Novice) on Nov 06, 2014 at 14:07 UTC

    I added one print statement - and now I understand the very literal impact of having an array in/not-in a string context.

    @coins = ("Quarter","Dime","Nickel"); print "@coins"; print "\n\r"; print @coins; print "\n\r"; print sort(@coins); print "\n\r"; Quarter Dime Nickel QuarterDimeNickel DimeNickelQuarter
    Again, thanks!!