in reply to formline and right-justification [SOLVED]

i'm limited to formline (and format), so no additional modules can be included.
Why are you limited & can't use modules?
If it's because this is homework, you should have told us is was.. If it's because you don't have root, be sure to Super Search for how to locally install modules (this comes up a lot).

Also, if you want the output string to be truncated to 10 chars, then use substr ... this demonstrates the difference:
while(<DATA>){ chomp; print "== $_ ==\n"; printf "printf: [%10s]\n", $_; printf "substr: [%10s]\n", substr($_, -10); } __DATA__ abc abcdefghjiklmnopqrstuvwxyz

Replies are listed 'Best First'.
Re^2: formline and right-justification
by nostromo (Sexton) on Jun 18, 2006 at 15:20 UTC
    it seems the substr-approach is the best, as already suggested by freakingwildchild. so i will take this one.
    thanks a lot, davidrw :)

    PS: no homework, no user+permission-problem.
    it should be "portable", this means the users should not be forced to install any other modules.
    the program should run with the modules that come with perl itself.
      Y, that's the 3rd common reason people say "i can't use modules" ..
      have a look at PAR and its pp script for packaging up all module dependencies for distribution..
        thanks for your hint on PAR.
        but i guess right now it's less work to avoid including additional modules, then to RTFMing the PAR man-page :)