Think about Loose Coupling | |
PerlMonks |
Re^13: appending a variableby pryrt (Abbot) |
on Apr 29, 2022 at 15:46 UTC ( [id://11143441]=note: print w/replies, xml ) | Need Help?? |
Here is an example of a couple of methods of implementing a similar task to what you are trying.
This will output
If you need to, play around with the example, and see if you can figure out a sprintf command that will do 5 digits. Or one that will merge the strings in a different order. Once you've played around some, and understood what this code is doing, then try to apply it to your own project. update: also, maybe you didn't know, but the page sprintf describes what everything means, including %d vs %2d vs %02d vs %0*d. You should try to read and understand that page. It will really help you. Generic advice: If you are unable to learn from this example and apply it to your own project (or, for that matter, from many of the other examples that have been given you throughout this discussion -- I don't claim mine is the ultimate of examples for learning from), then you need to find a "Beginning Perl" course (either video or text-based), and work you way through that, making sure you understand each individual step, until you have learned the variable and string manipulation skills to be able to understand the examples that your fellow Monks have been giving you in this discussion. You need to get to the point where you can learn from other examples, even if they aren't matching your exact text -- otherwise, you are not writing the code, you are begging others to write snippets for you, then maybe you are trying to glue them together, and hoping it works. You will not be successful in this project or in any future projects if you are unable to apply the examples that you have been given to situations that don't exactly match what you need.
In Section
Seekers of Perl Wisdom
|
|