Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^3: Weird encoding after grabing filenames

by ikegami (Pope)
on Jun 16, 2009 at 20:53 UTC ( #772139=note: print w/replies, xml ) Need Help??

in reply to Re^2: Weird encoding after grabing filenames
in thread Weird encoding after grabing filenames

can't it be done without a repeatiton loop?

You want to repeat an action without a loop?

Well, I suppose you could do

from_to($menu_files[0], 'ISO-8859-7', 'UTF-8') if @menu_files >= 1; from_to($menu_files[1], 'ISO-8859-7', 'UTF-8') if @menu_files >= 2; from_to($menu_files[2], 'ISO-8859-7', 'UTF-8') if @menu_files >= 3; from_to($menu_files[3], 'ISO-8859-7', 'UTF-8') if @menu_files >= 4; die("Need more!") if @menu_files >= 5;

Does it count as a loop if the repeating is done by the person rather than the computer?

Or if all you want to do is hide the loop

sub from_to_multi { my $fr = shift; my $to = shift; from_to($_, $fr, $to) for @_; } from_to_multi('ISO-8859-7', 'UTF-8', @menu_files);

But then you end up with two loops. One to place the elements on the stack, and one to process the elements on the stack.

Replies are listed 'Best First'.
Re^4: Weird encoding after grabing filenames
by Nik on Jun 17, 2009 at 09:42 UTC
    I'a, really sorry now you are right to accuse me of not expressign myself correctly to what i need to do.
    The way i should have asked would be "How to change this line Encode::from_to(@menu_files, 'ISO-8859-7', 'utf8') since it's first argument cannnot be an array, to a repeatition structure that could take place in only an one line which is Encode::from_to($_, 'ISO-8859-7', 'utf8') for (@menu_files); and not like the following:
    for $menu_file (@menu_files) { Encode::from_to($menu_file, 'ISO-8859-7', 'utf8'); }
    I'am sorry sometimes i need to say what i want in a short kind of a way, so to avoid posting too many lines but i fail to do it properly when i hurry(an yesterday i was ansering at many threads at many forums).I'd be more carefull in future.

    Don't take this as an insult, but hopefully one, Graff, understood what i meant :-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://772139]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2017-05-26 17:41 GMT
Find Nodes?
    Voting Booth?