[31332] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2577 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 1 18:56:52 2009

Date: Tue, 1 Sep 2009 15:56:45 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 1 Sep 2009     Volume: 11 Number: 2577

Today's topics:
        appending to a file. <rodbass63@gmail.com>
    Re: appending to a file. <glex_no-spam@qwest-spam-no.invalid>
    Re: appending to a file. <hjp-usenet2@hjp.at>
    Re: appending to a file. (Randal L. Schwartz)
    Re: appending to a file. <uri@StemSystems.com>
    Re: appending to a file. <rodbass63@gmail.com>
    Re: appending to a file. <jurgenex@hotmail.com>
    Re: Ban Xah Lee <gernot@NOTE049.local>
    Re: Ban Xah Lee <searles@hoombah.nurt.bt.uk>
    Re: Ban Xah Lee <nospam@nowhere.com>
    Re: cgi and escapeHTML but not ampersand <hjp-usenet2@hjp.at>
    Re: differences between find2perl and find <gerhard_ulrike@yahoo.de>
    Re: differences between find2perl and find <hjp-usenet2@hjp.at>
    Re: differences between find2perl and find <hjp-usenet2@hjp.at>
        FAQ 3.1 How do I do (anything)? <brian@theperlreview.com>
        FAQ 9.13 How do I edit my .htpasswd and .htgroup files  <perlfaq@theperlreview.com>
    Re: How can I get a character, given its Unicode index? <gypark@gmail.com>
    Re: How can I get a character, given its Unicode index? <kst-u@mib.org>
        How can you install MakeMaker... if you don't already h <jdaviestx@tx.rr.com>
    Re: How can you install MakeMaker... if you don't alrea <ben@morrow.me.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 31 Aug 2009 12:58:46 -0700 (PDT)
From: Nene <rodbass63@gmail.com>
Subject: appending to a file.
Message-Id: <3038e9c9-3b6a-4087-b200-4c813a5eedfb@n2g2000vba.googlegroups.com>

Greetings,

I want to open an apache file and append a line at the bottom of all
the Listen entries, not the bottom of the file. For example, I want to
append once it finds the last Listen entry in the file. For example,
the last Listen entry is 'Listen 8150', I want to append 'Listen 8151'
underneath Listen 8150. From what I read, I might have to use a
module, but I'm trying not install modules. Is it possible?

Listen 80
Listen 5555
Listen 443
Listen 7170
Listen 8002
Listen 8005
Listen 8008
Listen 8009
Listen 8010
Listen 8011
Listen 8013
Listen 8022
Listen 8023
Listen 8024
Listen 8045
Listen 8050
Listen 8051
Listen 8102
Listen 8108
Listen 8155
Listen 8110
Listen 8210
Listen 8211
Listen 8263
Listen 8122
Listen 8145
Listen 8346
Listen 8347
Listen 8147
Listen 8148
Listen 8146
Listen 8150


------------------------------

Date: Mon, 31 Aug 2009 15:20:44 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: appending to a file.
Message-Id: <4a9c309c$0$89390$815e3792@news.qwest.net>

Nene wrote:
> Greetings,
> 
> I want to open an apache file and append a line at the bottom of all
> the Listen entries, not the bottom of the file. For example, I want to
> append once it finds the last Listen entry in the file. For example,
> the last Listen entry is 'Listen 8150', I want to append 'Listen 8151'
> underneath Listen 8150. From what I read, I might have to use a
> module, but I'm trying not install modules. Is it possible?
> 
> Listen 80
[...]
> Listen 8150

You want to insert a line after some condition is true.

perldoc -q "How do I change, delete, or insert a line in a file"




------------------------------

Date: Mon, 31 Aug 2009 22:17:10 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: appending to a file.
Message-Id: <slrnh9obu6.9ab.hjp-usenet2@hrunkner.hjp.at>

On 2009-08-31 19:58, Nene <rodbass63@gmail.com> wrote:
> I want to open an apache file and append a line at the bottom of all
> the Listen entries, not the bottom of the file. For example, I want to
> append once it finds the last Listen entry in the file. For example,
> the last Listen entry is 'Listen 8150', I want to append 'Listen 8151'
> underneath Listen 8150. From what I read, I might have to use a
> module, but I'm trying not install modules. Is it possible?

No, you don't need a module (You never *need* a module. Modules make
things simpler because you can just use them instead of writing the code
yourself). But you can't insert something in the middle of a file. What
you can do is:

1) Read the file into memory (either as a string or an array of lines).

2) Search for the correct position and Insert the line "Listen 8150\n".

3) Write the new file.

(The module File::Slurp makes step 1 and 3 easier, but both are only a
few lines anyway)

	hp



------------------------------

Date: Mon, 31 Aug 2009 13:13:53 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: appending to a file.
Message-Id: <86ljkzd9mm.fsf@blue.stonehenge.com>

>>>>> "Nene" == Nene  <rodbass63@gmail.com> writes:

Nene> Greetings, I want to open an apache file and append a line at the bottom
Nene> of all the Listen entries, not the bottom of the file. For example, I
Nene> want to append once it finds the last Listen entry in the file. For
Nene> example, the last Listen entry is 'Listen 8150', I want to append
Nene> 'Listen 8151' underneath Listen 8150. From what I read, I might have to
Nene> use a module, but I'm trying not install modules. Is it possible?

Nene> Listen 80 Listen 5555 Listen 443 Listen 7170 Listen 8002 Listen 8005
Nene> Listen 8008 Listen 8009 Listen 8010 Listen 8011 Listen 8013 Listen 8022
Nene> Listen 8023 Listen 8024 Listen 8045 Listen 8050 Listen 8051 Listen 8102
Nene> Listen 8108 Listen 8155 Listen 8110 Listen 8210 Listen 8211 Listen 8263
Nene> Listen 8122 Listen 8145 Listen 8346 Listen 8347 Listen 8147 Listen 8148
Nene> Listen 8146 Listen 8150

Use "in-place-edit" mode:

    my $line_to_insert = "Listen 8151\n";

    {
      local @ARGV = "/path/to/your/httpd.conf";
      local $^I = ".bak"; # appended to the backup copy

      while (<>) {

        if ((/^Listen/..!/^Listen/) =~ /e/) { # if we're at the end of the Listens
          $_ = $line_to_insert . $_; # prepend the line to the next line
        }
        print; # but print whatever we have
      }

    }

print "Just another Perl hacker,"; # the original

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


------------------------------

Date: Mon, 31 Aug 2009 16:25:41 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: appending to a file.
Message-Id: <87bplv4toa.fsf@quad.sysarch.com>

>>>>> "N" == Nene  <rodbass63@gmail.com> writes:

  N> I want to open an apache file and append a line at the bottom of all
  N> the Listen entries, not the bottom of the file. For example, I want to
  N> append once it finds the last Listen entry in the file. For example,
  N> the last Listen entry is 'Listen 8150', I want to append 'Listen 8151'
  N> underneath Listen 8150. From what I read, I might have to use a
  N> module, but I'm trying not install modules. Is it possible?

that isn't appending, but inserting. please use the right term.

as for not using modules, that is silly and it has been discussed many
time. if you have an isp who doesn't install modules, change isps or
install them yourself. if you have a boss that doesn't allow them,
change jobs. if this is homework (which usually doesn't allow modules)
then say so and show perl code that we can help with.

otherwise there are still questions. do you always know the line where
the insert is to go? is the file sorted (it seems partially sorted from
your data)? how large is this file? (i doubt you are listening to
massive numbers of sockets.

there are several approaches and some can be done without modules. read
the file in line by line, print out each line to a new file and when you
get to the desired line, print the inserted line and the print the
rest. you can do this on the existing file with the -i option or to a
new file and rename it to the old one. you can use Tie::File and do this
in a simple loop. you can use File::Slurp and also do this in a simple
loop and even faster. in all cases you have to read in the whole file
and write it out again with the inserted line. on most file systems
today you can't directly insert lines in the middle of a file.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


------------------------------

Date: Mon, 31 Aug 2009 14:13:39 -0700 (PDT)
From: Nene <rodbass63@gmail.com>
Subject: Re: appending to a file.
Message-Id: <79952972-ebf4-45e6-bfc0-5d0142ade5dc@r33g2000vbp.googlegroups.com>

On Aug 31, 4:25=A0pm, "Uri Guttman" <u...@StemSystems.com> wrote:
> >>>>> "N" =3D=3D Nene =A0<rodbas...@gmail.com> writes:
>
> =A0 N> I want to open an apache file and append a line at the bottom of a=
ll
> =A0 N> the Listen entries, not the bottom of the file. For example, I wan=
t to
> =A0 N> append once it finds the last Listen entry in the file. For exampl=
e,
> =A0 N> the last Listen entry is 'Listen 8150', I want to append 'Listen 8=
151'
> =A0 N> underneath Listen 8150. From what I read, I might have to use a
> =A0 N> module, but I'm trying not install modules. Is it possible?
>
> that isn't appending, but inserting. please use the right term.
>
> as for not using modules, that is silly and it has been discussed many
> time. if you have an isp who doesn't install modules, change isps or
> install them yourself. if you have a boss that doesn't allow them,
> change jobs.

Uri, you made me laugh on this one. The economy and job market is bad
in Florida, I'll put up with the boss and not install modules.

if this is homework (which usually doesn't allow modules)
> then say so and show perl code that we can help with.
>
> otherwise there are still questions. do you always know the line where
> the insert is to go? is the file sorted (it seems partially sorted from
> your data)? how large is this file? (i doubt you are listening to
> massive numbers of sockets.
>
> there are several approaches and some can be done without modules. read
> the file in line by line, print out each line to a new file and when you
> get to the desired line, print the inserted line and the print the
> rest. you can do this on the existing file with the -i option or to a
> new file and rename it to the old one. you can use Tie::File and do this
> in a simple loop. you can use File::Slurp and also do this in a simple
> loop and even faster. in all cases you have to read in the whole file
> and write it out again with the inserted line. on most file systems
> today you can't directly insert lines in the middle of a file.
>
> uri
>
> --
> Uri Guttman =A0------ =A0u...@stemsystems.com =A0-------- =A0http://www.s=
ysarch.com--
> ----- =A0Perl Code Review , Architecture, Development, Training, Support =
------
> --------- =A0Gourmet Hot Cocoa Mix =A0---- =A0http://bestfriendscocoa.com=
---------



------------------------------

Date: Mon, 31 Aug 2009 16:34:49 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: appending to a file.
Message-Id: <1cno95hnalcg14gd9pgvj0iq296ub2om2s@4ax.com>

Nene <rodbass63@gmail.com> wrote:
>I want to open an apache file 

What is an apache file?

>and append a line at the bottom of all
>the Listen entries, not the bottom of the file. For example, I want to
>append once it finds the last Listen entry in the file. For example,
>the last Listen entry is 'Listen 8150', I want to append 'Listen 8151'
>underneath Listen 8150. From what I read, I might have to use a
>module, but I'm trying not install modules. Is it possible?

Which in your example below happens to be the last line in the file, so
you could just as well append to the end of the file.

[sample data snipped]

jue


------------------------------

Date: Tue, 01 Sep 2009 15:48:52 +0900
From: Gernot Hassenpflug <gernot@NOTE049.local>
Subject: Re: Ban Xah Lee
Message-Id: <m2vdk3upm3.fsf@NOTE049.local.i-did-not-set--mail-host-address--so-tickle-me>

Arved Sandstrom <dcest61@hotmail.com> writes:

> Xah Lee wrote:
>> over the past 15 years, every few months i got emails from authors for
>> permission request of materials on my website.
>>
>> today, while searching for my name on google, i found a result in
>> books.google.com . Out of curiosity, i searched my name in
>> books.google.com, and here's a hilarious result:
>>
>> Machine Learning and Data Mining in Pattern Recognition: 5th
>> International Conference, MLDM 2007, Leipzig, Germany, July 18-20,
>> 2007, Proceedings (Lecture ... / Lecture Notes in Artificial
>> Intelligence) (Paperback)
>> by Petra Perner (Editor)
>>
>> http://books.google.com/books?id=CE1QzecoVf4C&pg=PA401&dq=xah+lee#PPA401,M1
>>
>> Hilarious! (^o^)
>>
>> He says: “... Barely considering du, he is easily to be neglected”.
>> What the hell does that mean!!? :)
>>
>>   Xah
>> ∑ http://xahlee.org/
>>
>> ☄
>
> I think it means that she considers your datapoint to be an outlier,
> and that the actual number of posts to CLPM was not really a
> consideration in reaching that conclusion.
>
> AHS

Crap, what the hell are *you* doing here, Arved. This is so frightening!

LOL
Gernot (shocked to find people have other interests, hehe)


------------------------------

Date: Tue, 01 Sep 2009 03:02:32 -0400
From: Dave Searles <searles@hoombah.nurt.bt.uk>
Subject: Re: Ban Xah Lee
Message-Id: <h7igu9$cnu$2@news.eternal-september.org>

Gernot Hassenpflug wrote:
> Arved Sandstrom <dcest61@hotmail.com> writes:
>> I think it means that she considers your datapoint to be an outlier,
>> and that the actual number of posts to CLPM was not really a
>> consideration in reaching that conclusion.
>>
>> AHS
> 
> Crap, what the hell are *you* doing here, Arved. This is so frightening!

He's a regular poster to cljp, into which Xah crossposted this execrable 
thread, as he so often does.


------------------------------

Date: Tue, 01 Sep 2009 08:18:09 -0700
From: markspace <nospam@nowhere.com>
Subject: Re: Ban Xah Lee
Message-Id: <h7jdvk$gli$1@news.eternal-september.org>

Gernot Hassenpflug wrote:

> 
> Crap, what the hell are *you* doing here, Arved. This is so frightening!
> 
> LOL
> Gernot (shocked to find people have other interests, hehe)


Thanks for cross posting this to five different newsgroups.  Your 
garbage is not wanted here, here being clj.programmer.  Learn to use you 
newsreader and check where you posts are going before you send them.

Followup's sent to alt.flame.


------------------------------

Date: Mon, 31 Aug 2009 13:03:14 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: cgi and escapeHTML but not ampersand
Message-Id: <slrnh9nbfj.69b.hjp-usenet2@hrunkner.hjp.at>

On 2009-08-30 13:26, Marek <mstep@podiuminternational.org> wrote:
> But I still don't know how to produce a valid charset=utf-8
> declaration with cgi.

print header(-charset=>'utf-8');

should work.

	hp


------------------------------

Date: Mon, 31 Aug 2009 09:42:06 -0700 (PDT)
From: Gerhard <gerhard_ulrike@yahoo.de>
Subject: Re: differences between find2perl and find
Message-Id: <d7273f97-89b5-4dc9-adbf-d5e70a5e8c88@e34g2000vbm.googlegroups.com>

On 28 Aug., 22:28, s...@netherlands.com wrote:

>
> Good luck. I'm not too suprised there were no responses.
>

but there is one that helps (--> perl -M-warnings)

thanks

by thw way ... i was a little bit confused by that difference => find
does not needs -print to print out files found, find2perl will not
print anything without this option


------------------------------

Date: Mon, 31 Aug 2009 22:22:23 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: differences between find2perl and find
Message-Id: <slrnh9oc80.9ab.hjp-usenet2@hrunkner.hjp.at>

On 2009-08-31 16:42, Gerhard <gerhard_ulrike@yahoo.de> wrote:
> On 28 Aug., 22:28, s...@netherlands.com wrote:
>> Good luck. I'm not too suprised there were no responses.
>>
>
> but there is one that helps (--> perl -M-warnings)
>
> thanks
>
> by thw way ... i was a little bit confused by that difference => find
> does not needs -print to print out files found, find2perl will not
> print anything without this option

Traditionally find *did* need -print to print out the files found. Now
it is optional, but the find2perl utility is quite old and probably
understands only find syntax from the 1980's.

	hp



------------------------------

Date: Mon, 31 Aug 2009 22:38:14 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: differences between find2perl and find
Message-Id: <slrnh9od5n.9ab.hjp-usenet2@hrunkner.hjp.at>

On 2009-08-28 06:53, GU <gerhard_ulrike@yahoo.de> wrote:
> Now i gonna try to convert find to a perl script using find2perl.....
>
> and will have some problems:
> gm@h213:/tmp ># redirect STDERR to avoid warnings caused by
> permissions
> gm@h213:/tmp >find * -prune -type d -mtime -30 2>/dev/null | tail -2
> tmpdir.21790
> tmpdir.27721
> gm@h213:/tmp >
> gm@h213:/tmp >find2perl  -prune -type d -mtime -30 | perl

Note that there is a very important difference between your call to find
and your call to find2perl:

In

find * -prune ...

the * will be expanded to all files in the current directory (except
those starting with "."). So here you really call 

find a_dir file1 file2 tmpdir.21790 tmpdir.27721 whatever -prune ...

But in 

find2perl  -prune ...

you don't give any file arguments. So this is equivalent to

find2perl . -prune ...

If you call

find . -prune ...

you probably will get the same results.


To get the same same result as with your find command, you could call

find2perl * -prune ...

but that would include the list of currently existing files in your
script which almost certainly means that the script is useless the next
time you want to run it (I assume that 'find2perl  -prune -type d -mtime
-30 | perl' is only used for demonstration purposes. Normally you would
save the script into a file and run it several times).

So you need to get the glob('*') that is normally performed by the shell
into you script:

> #! /usr/local/bin/perl -w
>     eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
>         if 0; #$running_under_some_shell
>
> use strict;
> use File::Find ();
>
> # Set the variable $File::Find::dont_use_nlink if you're using AFS,
> # since AFS cheats.
>
> # for the convenience of &wanted calls, including -eval statements:
> use vars qw/*name *dir *prune/;
> *name   = *File::Find::name;
> *dir    = *File::Find::dir;
> *prune  = *File::Find::prune;
>
>
> # Traverse desired filesystems
> File::Find::find({wanted => \&wanted}, **** list of files **** );
                                         ^^^^^^^^^^^^^^^^^^^^^^^
					 replace this with
					 glob("*")
					 or
					 @ARGV
> exit;

	hp



------------------------------

Date: Tue, 01 Sep 2009 22:19:14 GMT
From: PerlFAQ Server <brian@theperlreview.com>
Subject: FAQ 3.1 How do I do (anything)?
Message-Id: <C5hnm.2674$UH2.2556@newsfe01.iad>

This is an excerpt from the latest version perlfaq3.pod, which
comes with the standard Perl distribution. These postings aim to 
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

3.1: How do I do (anything)?

    Have you looked at CPAN (see perlfaq2)? The chances are that someone has
    already written a module that can solve your problem. Have you read the
    appropriate manpages? Here's a brief index:

            Basics          perldata, perlvar, perlsyn, perlop, perlsub
            Execution       perlrun, perldebug
            Functions       perlfunc
            Objects         perlref, perlmod, perlobj, perltie
            Data Structures perlref, perllol, perldsc
            Modules         perlmod, perlmodlib, perlsub
            Regexes         perlre, perlfunc, perlop, perllocale
            Moving to perl5 perltrap, perl
            Linking w/C     perlxstut, perlxs, perlcall, perlguts, perlembed
            Various         http://www.cpan.org/misc/olddoc/FMTEYEWTK.tgz
                            (not a man-page but still useful, a collection
                             of various essays on Perl techniques)

    A crude table of contents for the Perl manpage set is found in perltoc.



--------------------------------------------------------------------

The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
are not necessarily experts in every domain where Perl might show up,
so please include as much information as possible and relevant in any
corrections. The perlfaq-workers also don't have access to every
operating system or platform, so please include relevant details for
corrections to examples that do not work on particular platforms.
Working code is greatly appreciated.

If you'd like to help maintain the perlfaq, see the details in 
perlfaq.pod.


------------------------------

Date: Tue, 01 Sep 2009 21:37:11 GMT
From: PerlFAQ Server <perlfaq@theperlreview.com>
Subject: FAQ 9.13 How do I edit my .htpasswd and .htgroup files with Perl?
Message-Id: <bugnm.136066$cf6.72102@newsfe16.iad>

This is an excerpt from the latest version perlfaq9.pod, which
comes with the standard Perl distribution. These postings aim to 
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

9.13: How do I edit my .htpasswd and .htgroup files with Perl?

    The HTTPD::UserAdmin and HTTPD::GroupAdmin modules provide a consistent
    OO interface to these files, regardless of how they're stored. Databases
    may be text, dbm, Berkeley DB or any database with a DBI compatible
    driver. HTTPD::UserAdmin supports files used by the "Basic" and "Digest"
    authentication schemes. Here's an example:

            use HTTPD::UserAdmin ();
            HTTPD::UserAdmin
              ->new(DB => "/foo/.htpasswd")
              ->add($username => $password);



--------------------------------------------------------------------

The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
are not necessarily experts in every domain where Perl might show up,
so please include as much information as possible and relevant in any
corrections. The perlfaq-workers also don't have access to every
operating system or platform, so please include relevant details for
corrections to examples that do not work on particular platforms.
Working code is greatly appreciated.

If you'd like to help maintain the perlfaq, see the details in 
perlfaq.pod.


------------------------------

Date: Sun, 30 Aug 2009 20:10:40 -0700 (PDT)
From: Raymundo <gypark@gmail.com>
Subject: Re: How can I get a character, given its Unicode index?
Message-Id: <927d892f-e548-4f9c-8069-92f3d2c7d420@a39g2000pre.googlegroups.com>

On 8=EC=9B=9431=EC=9D=BC, =EC=98=A4=EC=A0=843=EC=8B=9C26=EB=B6=84, "John W.=
 Krahn" <some...@example.com> wrote:
> Klaus wrote:
> > the easiest would be:
>
> > my $index =3D "AC00";
> > my $char =3D chr(oct("0x$index"));
>
> Or:
>
> my $char =3D chr hex $index;
>


Oops, "chr" can receive Unicode index as its argument.

I've thought it accepts only bytes (0~255)... I'm so sorry for
bothering you.

Thank you all.
G.Y.Park in South Korea


------------------------------

Date: Mon, 31 Aug 2009 13:30:45 -0700
From: Keith Thompson <kst-u@mib.org>
Subject: Re: How can I get a character, given its Unicode index?
Message-Id: <ln1vmrafpm.fsf@nuthaus.mib.org>

"John W. Krahn" <someone@example.com> writes:
> Klaus wrote:
>> On 30 août, 18:47, Raymundo <gyp...@gmail.com> wrote:
>>> To represent a Unicode character in a string or in a regexp, I can use
>>> "\x{hex}" notation.
>>>
>>> my $char = "\x{AC00}";
>>> # $char = "가" -- a Korean character, pronounced "GA"
>>
>> [...]
>>
>>> But I still wonder if there is a Perl internel function or standard
>>> module that do same thing.
>>
>> perldoc -f chr
>> perldoc -f oct
>>
>> the easiest would be:
>>
>> my $index = "AC00";
>> my $char = chr(oct("0x$index"));
>
> Or:
>
> my $char = chr hex $index;

Or:

my $index = 0xAC00;
my $char = chr $index;

Though if you have the index as a string, you'll need to use hex().

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"


------------------------------

Date: Sun, 30 Aug 2009 19:44:17 -0700 (PDT)
From: jdaviestx <jdaviestx@tx.rr.com>
Subject: How can you install MakeMaker... if you don't already have MakeMaker  installed?
Message-Id: <7a0572e6-a7fb-4d45-a5f1-b431d2cd8ce9@q14g2000vbi.googlegroups.com>

Ok, short version - I'm trying to install MakeMaker.  I downloaded it
from here (http://search.cpan.org/CPAN/authors/id/M/MS/MSCHWERN/
ExtUtils-MakeMaker-6.54.tar.gz) gunzipped and untarred it.  However,
it only has a "Makefile.PL" at the top level, and if I try:

perl Makefile.PL

obviously it fails because of this line:

use ExtUtils::MakeMaker 6.50;

 ... since I don't already have MakeMaker (I'm trying to install it).

Am I missing something painfully obvious?  I'm not really a perl
person (although it's on my list of things to learn)... I'm trying to
install X from source - X relies on xcb-lib, which relies on pthreads-
stubs, which relies on autoconf, which relies on Data::Dumper, which
finally relies on MakeMaker (which appears to rely on itself...)

TIA!


------------------------------

Date: Mon, 31 Aug 2009 12:17:10 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: How can you install MakeMaker... if you don't already have MakeMaker  installed?
Message-Id: <m2osm6-e5h1.ln1@osiris.mauzo.dyndns.org>


Quoth jdaviestx <jdaviestx@tx.rr.com>:
> Ok, short version - I'm trying to install MakeMaker.  I downloaded it
> from here (http://search.cpan.org/CPAN/authors/id/M/MS/MSCHWERN/
> ExtUtils-MakeMaker-6.54.tar.gz) gunzipped and untarred it.  However,
> it only has a "Makefile.PL" at the top level, and if I try:
> 
> perl Makefile.PL
> 
> obviously it fails because of this line:
> 
> use ExtUtils::MakeMaker 6.50;
> 
> ... since I don't already have MakeMaker (I'm trying to install it).

Firstly, you *do* already have MakeMaker. It's been part of the perl 5
core since the beginning.

Secondly, it's not obvious it should fail. You missed this line:

    use lib qw(lib inc);    # build ourself with ourself

which should allow Makefile.PL to load the version of MM you are trying
to install. What exactly did you run, what version of perl are you
using, what OS, and what exactly was the error message?

Ben



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 2577
***************************************


home help back first fref pref prev next nref lref last post