in reply to slice of ptr-based-output routines?
Sigh... Copy the string $snap_lvh-> to the clipboard, then paste it each time. If the set of fields is never going to change during the life of the program, “you only have to type it once.”
If the list of fields is truly variable, then the list of field-names can be put into an array or list and then foreach my $foo (@list) you can use the syntax: $lv_name->{$foo}.
But in any case your aim should be perfect clarity and maintainability; not a momentary ease of effort for your fingers. The day may well come when one of those output statements must be slightly different from the rest. Beware of unwanted “coupling” between one occurrence of a statement and the next.
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: slice of ptr-based-output routines?
by perl-diddler (Chaplain) on Aug 01, 2012 at 21:02 UTC |