tie a hash to a file

2018-08-01 Thread Lauren C.
Do you know how to tie a hash to a disk file thus read by another process? Currently my solution is writing the data to a JSON file and read it from the other program. Thank you.

Re: Eclipse/Epic/PadWalker for Perl

2018-07-30 Thread Lauren C.
[OT] maybe you want to change IDE to vi/vim since you are using Perl. :) 发件人: James Kerwin 日期: 2018年7月30日 星期一 下午9:19 至: 主题: Eclipse/Epic/PadWalker for Perl Hi all, I appreciate this isn't a place for the Eclipse IDE, but maybe some of you may have an answer. I installed Eclipse Photon,

Re: regex matches Chinese characters

2018-07-26 Thread Lauren C.
oops that's perfect. thanks Shlomi. On 2018/7/27 星期五 PM 1:26, Shlomi Fish wrote: Hi Lauren, On Fri, 27 Jul 2018 11:28:42 +0800 "Lauren C." wrote: greetings, I was doing the log statistics stuff using perl. There are chinese characters in log items. I tried with regex to match the

regex matches Chinese characters

2018-07-26 Thread Lauren C.
greetings, I was doing the log statistics stuff using perl. There are chinese characters in log items. I tried with regex to match them, but got no luck. $ perl -mstrict -le 'my $char="汉语"; print "it is chinese" if $char =~ /\p{Han}+/' $ perl -mstrict -mutf8 -le 'my $char="汉语"; print "it is

Re: confidence under BEGIN{}

2018-07-26 Thread Lauren C.
gt; package mytest; sub hello {   print "hello\n" } 1; $ perl -e 'BEGIN {push  @INC, "test";} use mytest; mytest::hello()' hello or, as Perl treats the "::" as a path denoter: $ perl -e 'use test::mytest; mytest::hello()' hello or: $ perl -mtest::mytest -e 'mytest::hello()' hell

confidence under BEGIN{}

2018-07-25 Thread Lauren C.
Hi Morning, I have a package file in "./test" dir. $ ls test/ mytest.pm I try to include it but got failed. $ perl -le 'use mytest' Can't locate mytest.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5

Re: about system() call

2018-07-24 Thread Lauren C.
yes I also found a more direct way, use Image::Resize; $image = Image::Resize->new('large.jpg'); $gd = $image->resize(250, 250); thanks for everyone. On 2018/7/25 星期三 PM 1:51, Илья Рассадин wrote: You can resize image with Perl. For example, Imager library can do the thing. See

Re: about system() call

2018-07-24 Thread Lauren C.
to do the work: system "convert lauren.jpg -resize 300x300 lauren.jpg" But I think it's not good, since as you said, a shell is always being called. How to write it with pure perl way? regards. On 2018/7/24 星期二 PM 11:31, Uri Guttman wrote: On 07/24/2018 08:35 AM, Lauren C. wrote: H

about system() call

2018-07-24 Thread Lauren C.
Hi, $ perl -le 'system "df -h"' $ perl -le 'system "df","-h"' The both two styles work fine. what's the difference between them and which is better usage? thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org

Re: help with another regex

2018-07-17 Thread Lauren C.
I think reading the official tutorial from begin is not that comfortable to a newbie. I bought a book "Learning Perl, 6th Edition" for studying step by step. thanks. On 2018/7/18 星期三 AM 9:08, Uri Guttman wrote: also i always recommend reading the entire perl FAQ as there are many regex tips

Re: help with another regex

2018-07-17 Thread Lauren C.
I did read them, but got no deep impression unless I met the issue. :) Uri Guttman 写道: On 07/17/2018 08:46 PM, Lauren C. wrote: Thanks Gil. I think i know the difference of "\w+" and "\w*" now. lauren, did you read the perlretut document? if not, you should. it cove

Re: help with another regex

2018-07-17 Thread Lauren C.
at the begining of the RE) your RE would fail too: $ perl -le '$x="/path/"; print 1 if $x=~m{^path/}' because the RE starts w/ "p" and the $x starts with slash. On Tue, Jul 17, 2018 at 6:56 AM, Lauren C. <mailto:lau...@miscnote.net>> wrote: Hello, I want

Re: help with another regex

2018-07-17 Thread Lauren C.
Thanks Gil. I think i know the difference of "\w+" and "\w*" now. Gil Magno 写道: 2018-07-17 19:56:59 +0800 Lauren C.: Hello, I want to match: /path/ /path/123 /path/abc but /path/?xxx should not be matched. This works: $ perl -le '$x="/path/abc";

help with another regex

2018-07-17 Thread Lauren C.
Hello, I want to match: /path/ /path/123 /path/abc but /path/?xxx should not be matched. This works: $ perl -le '$x="/path/abc"; print 1 if $x=~m{path/\w+}' 1 this works too: $ perl -le '$x="/path/?abc"; print 1 if $x=~m{path/\w+}' But it doesn't work for this case: $ perl -le

Re: help with a stat script

2018-07-12 Thread Lauren C.
Hi Uri, I was reading this page: https://www.rexegg.com/regex-lookarounds.html the content of "Mastering Lookahead and Lookbehind" make me confused. (?=foo) (?<=foo) (?!foo) (?but seriously, regexes are a key feature in perl and most modern languages. it is hard to do any text or data

Re: help with a stat script

2018-07-12 Thread Lauren C.
at 19:35 +0800, Lauren C. wrote: My web is powered by Apache and PHP,its access log seems as blow, xx.xx.xx.xx - - [12/Jul/2018:19:29:43 +0800] "GET /2018/07/06/antique-internet/ HTTP/1.1" 200 5489 "https://miscnote.ne t/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6)

Re: help with a stat script

2018-07-12 Thread Lauren C.
OK I see, thanks Gil. I think the main problem is I don't know much about regex. I will re-learn them this day. On 2018/7/12 星期四 PM 10:02, Gil Magno wrote: 2018-07-12 20:50:22 +0800 Lauren C.: thanks for the kind helps. do you know what the expression in { } stands for? ^(\S+) - - \[(\S

Re: help with a stat script

2018-07-12 Thread Lauren C.
Thanks Jim. that explains clearly. On 2018/7/12 星期四 PM 10:00, Jim Gibson wrote: On Jul 12, 2018, at 5:50 AM, Lauren C. wrote: thanks for the kind helps. do you know what the expression in { } stands for? ^(\S+) - - \[(\S+).*\] \"GET (.*?/)\s+ Here is a breakdown: ^

Re: help with a stat script

2018-07-12 Thread Lauren C.
thanks for the kind helps. do you know what the expression in { } stands for? ^(\S+) - - \[(\S+).*\] \"GET (.*?/)\s+ On 2018/7/12 星期四 PM 8:37, Илья Рассадин wrote: "m{ pattern }" is regular expression to parse log string. It's equal to just "/ pattern /". Using different delimiter is

Re: help with a stat script

2018-07-12 Thread Lauren C.
thanks Magno. i will check it. On 2018/7/12 星期四 PM 8:13, Gil Magno wrote: Hi, Lauren The m{...} is a regular expression (regexp). If you not familiar with regexps in Perl, I advise you to read these pages: -http://perldoc.perl.org/perlintro.html#Regular-expressions

help with a stat script

2018-07-12 Thread Lauren C.
Hello, My web is powered by Apache and PHP,its access log seems as blow, xx.xx.xx.xx - - [12/Jul/2018:19:29:43 +0800] "GET /2018/07/06/antique-internet/ HTTP/1.1" 200 5489 "https://miscnote.net/; "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko)