Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: utf8 "\xB7" does not map to Unicode at /usr/local/bin/бибс/об‰ line 112.

by graff (Chancellor)
on Nov 05, 2015 at 04:48 UTC ( [id://1146965]=note: print w/replies, xml ) Need Help??


in reply to Re^2: utf8 "\xB7" does not map to Unicode at /usr/local/bin/бибс/об‰ line 112.
in thread utf8 "\xB7" does not map to Unicode at /usr/local/bin/бибс/об‰ line 112.

If you look at the code snippet I posted, you'll see that I did not redirect the output of "find" to /dev/null -- as pointed out in the other replies above, that's why your array remained empty.

One other point: now that you're pushing entries into an array, you'll probably want to use chomp -- e.g. like this:

open(my $find,"|-:utf8","find /usr/local/bin -type f") or die "find fa +iled: $!\n"; while( <$find> ){ chomp; push @array, $_; }
or leave out the while loop and chomp the whole array, like this:
open( my $find, ... ) # (same as above, without redirecting to "/dev/n +ull") my @array = <$find>; # reads all lines into array chomp @array; # strips linefeeds from all array elements
  • Comment on Re^3: utf8 "\xB7" does not map to Unicode at /usr/local/bin/бибс/об&#137; line 112.
  • Select or Download Code

Replies are listed 'Best First'.
Re^4: utf8 "\xB7" does not map to Unicode at /usr/local/bin/бибс/об&#137; line 112.
by nikolay (Beadle) on Nov 07, 2015 at 01:56 UTC
    Thank you, so i will do, but i have to fill array first.
      I guess you are having trouble understanding what I'm saying -- both in English and in Perl. In the last snippet that I presented above (three lines of code), the array gets filled in the second line. The array is also declared and initialized in that line, so after that line executes, you can be confident that the array contains all and only the output of the "find" command.

      So, try putting the "binmode" statements above those three lines, make sure that the content of the "find" command itself is correct, add a line or a loop after my three lines, to print stuff out from the array, and see what happens. If you still have trouble after that, POST THE COMPLETE SCRIPT THAT YOU RAN, together with enough output (and error/warning messages) from running THAT EXACT VERSION of the script -- then it will be clearer to us what is going on. So far, you have been making it hard for us.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1146965]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-04-19 11:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found