supriyoch_2008 has asked for the wisdom of the Perl Monks concerning the following question:
Hi Perl Monks,
I am a beginner in perl programming. Can you help me to sort out a simple problem in perl script writing? I have used a map function in the middle of a program i.e.
say $_ for map {sprintf (“%d”, length)} split/$motif/, $string;It works nicely in command prompt in Windows XP and shows the results correctly. But I want the results of this line (e.g. 0 6 7 8 4 etc. ) printed in a .txt or .docx page as output. So, I need to assign the result of this code to a variable like $a or @a for use in print command like print ”$a or @a”;.
I searched for references in Google but those references have not worked in my program. I shall appreciate if any perl monk can help me sort out this problem by assigning a suitable variable to the output of this code to get the result as print ”$a or @a “; in my program.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Request to sort out a problem in perl program for getting result as print "@a or $a" of a map function code
by jwkrahn (Abbot) on Jan 23, 2012 at 08:58 UTC | |
|
Re: Request to sort out a problem in perl program for getting result as print "@a or $a" of a map function code
by ikegami (Patriarch) on Jan 23, 2012 at 09:33 UTC | |
|
Re: Request to sort out a problem in perl program for getting result as print "@a or $a" of a map function code
by kielstirling (Scribe) on Jan 23, 2012 at 09:46 UTC |