http://www.perlmonks.org?node_id=984893


in reply to Re: slice of ptr-based-output routines?
in thread slice of ptr-based-output routines?

Are you saying a slice is less clear than spelling out the pointer with each element?

I don't think I emphasized the point clearly enough -- the above was a transitory debug line put in to look at those values. I didn't want a loop or supporting routines... just wanted to print. Pe is a shortcut routine all in of itself, It' alternate of P, which prints to STDOUT by default (or to a string, in string context). Auto traps/handles undef's in printed args and auto deals with linefeed (adds as final char going to a file handle if needed).

Each item I am printing is a 'class variable' and all of those subs are 'accessor routines'...writing additional routines just to print the value of accessor routines is way overkill for a debug statement.

It's all about easy of programming... computers were designed to be the servants of humans -- not the otherway around.

I just thought a slice like statement where each accessor is called off the same pointer would be more clear than retyping the accessor 5 times. Aren't we supposed to avoid duplication in code?

Sorry if I was unclear, but I did try to stress it was only debugging code.

  • Comment on Re^2: slice of ptr-based-output routines?