Re: Fwd: Win32::OLE merge rtf files - table structure missing

2022-06-15 Thread perl kamal
─┼───┼─┼ > │BPD │2.44cm │35.57% │14w1d│ > ├┼───┼───┼─┼ > │HCD │9.08cm │20.90% │14w1d│ > └┴───┴───┴─┴ > &g

Re: Fwd: Win32::OLE merge rtf files - table structure missing

2022-06-15 Thread Mike
│9.08cm │20.90% │14w1d│ └┴───┴───┴─────┴ I can serve up those files on my website if anybody else comes along and wants to see them. I gather the comments section at

Re: Win32::OLE merge rtf files - table structure missing

2022-06-14 Thread perl kamal
Trying to upload the source file content here... *Clinical Indications & Data* *LMP: *25/01/2022*GA: *14w1d*EDD(LMP): *01/11/2022*AUA: *14w0d* EDD(AUA): *02/11/2022*Gestations: *1 *Obstetrics-Page * *2D Measurements* *BPD* *Hadlock* *2.44cm* *35.57%*

Fwd: Win32::OLE merge rtf files - table structure missing

2022-06-14 Thread perl kamal
Subject: Re: Win32::OLE merge rtf files - table structure missing To: Cc: There are a bunch of steps there. When you say "construct a table" - in what format? Is the finished product an html file? Do you know how to parse the rtf file already? If not, send an rtf file to me at te...

Re: Win32::OLE merge rtf files - table structure missing

2022-06-14 Thread Mike
There are a bunch of steps there. When you say "construct a table" - in what format? Is the finished product an html file? Do you know how to parse the rtf file already? If not, send an rtf file to me at te...@mflan.com I have attached a file to see if the list accepts attachments. Mike O

Win32::OLE merge rtf files - table structure missing

2022-06-13 Thread perl kamal
Hi, Greetings!!! I am trying to process an rtf file , get the content from a paragraph,construct a table with the processed data and update it at the "Comments:'' table which is at the end of the file. My expected table structure is not updated while merging the contents. Your comments/suggestions

Re: Website Files Preview as Thumbnail

2019-04-26 Thread Dermot
where to start. > > I run a publications repository/website that uses Perl on its back end. On > each page I have a series of files. At the moment they display a thumbnail > as the file icon (different for file type such as .doc, .jpg, .pdf etc.). > > I have seen some similar websites

Website Files Preview as Thumbnail

2019-04-26 Thread James Kerwin
Hi All, I promise this question is about Perl. I've googled this a lot and still can't find where to start. I run a publications repository/website that uses Perl on its back end. On each page I have a series of files. At the moment they display a thumbnail as the file icon (differen

Re: How to compare timestamp in two different files(regex)

2018-10-25 Thread armando perez pena
Dear All, This is a Perl place for Python there are many places. BR, Armando El 25/10/18 a las 17:17, Chris Fedde escribió: why post a python solution here? On Thu, Oct 25, 2018 at 8:58 AM Asad mailto:asad.hasan2...@gmail.com>> wrote: Hi , Yes i have the code : import re import datetime fr

Re: How to compare timestamp in two different files(regex)

2018-10-25 Thread Chris Fedde
why post a python solution here? On Thu, Oct 25, 2018 at 8:58 AM Asad wrote: > Hi , > > Yes i have the code : > > import re > import datetime > from datetime import timedelta > > Header = "*" > > f3 = open ( r"D:\QI\logA.txt", 'r' ) > string =

Re: How to compare timestamp in two different files(regex)

2018-10-25 Thread Asad
Hi , Yes i have the code : import re import datetime from datetime import timedelta Header = "*" f3 = open ( r"D:\QI\logA.txt", 'r' ) string = f3.read () regex = re.compile ( "\n" ) st = regex.sub ( " ", string ) st1 = st.split ( " " ) if re.

Re: How to compare timestamp in two different files(regex)

2018-10-25 Thread Jim Gibson
(Please reply to the list.) If you have written code that extracts the date and time from the ‘LOG flle opened’ lines in the log file, then please show us your code. You seem to be asking other people to write your program for you. You will get better help if you appear to be making an effort t

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Jim Gibson
> On Oct 24, 2018, at 9:54 PM, Asad wrote: > > Thank all now I am able to progress : > > file1 i am able to extract the start and end timestamp > file 2 i am able to extract the timestamp > > used the following > my $t1 = Time::Piece->strptime('Feb 23 01:10:28 2018', '%b %d %H:%M:%S %Y'

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Asad
Thank all now I am able to progress : file1 i am able to extract the start and end timestamp file 2 i am able to extract the timestamp used the following my $t1 = Time::Piece->strptime('Feb 23 01:10:28 2018', '%b %d %H:%M:%S %Y'); coming from file1 my $t2 = Time::Piece->strptime('02/23/18 01:

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Martin McCormick
Someone brought to my attention that I had failed to define a couple of variables in the sample code I posted and they were quite right. I don't mind sharing my work but the entire application I wrote to get a brief local weather summary is 242 lines and I was trying to stay close to the topic, he

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Andy Bach
===> I am using the following regex : ([A-Z][a-z]{2}\s)([0-9]{2}\s[0-2][0-9](:[0-5][0-9]){2}\s[0-9]{4}) > Both are working as expected I would like to know if these are good regex or it can be better , please suggest . Concurring with the others, your setting yourself up for trouble with the RE

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Chris Fedde
I cannot emphasize enough how fragile the perhaps obvious regex based comparisons of timestamps can be. I second the approach demonstrated by Илья Рассадин above. There are subtle and difficult to debug problems buried in timestamps. Not least of which is locale ambiguity, discontinuities like da

Re: How to compare timestamp in two different files(regex)

2018-10-23 Thread Olivier
Hi, > Thank you all for the reply it is working for me . > > 1) for 02/23/18 01:10:33 ==> I am using the following regex > \d\d/\d\d/\d\d\s[012][0-9]:[0-5][0-9]:[0-5][0-9] > 2) Feb 23 01:10:28 2018 > > I am using the following regex : > ([A-Z][a-z]{2}\s)([0-9]{2}\s[0-2][0-9](:[0-5][0-9]){2}\

Re: How to compare timestamp in two different files(regex)

2018-10-23 Thread Asad
Thank you all for the reply it is working for me . 1) for 02/23/18 01:10:33 ==> I am using the following regex \d\d/\d\d/\d\d\s[012][0-9]:[0-5][0-9]:[0-5][0-9] 2) Feb 23 01:10:28 2018 > I am using the following regex : ([A-Z][a-z]{2}\s)([0-9]{2}\s[0-2][0-9](:[0-5][0-9]){2}\s[0-9]{4})

Re: How to compare timestamp in two different files(regex)

2018-10-23 Thread Andy Bach
the file 4 uid numeric user ID of file's owner 5 gid numeric group ID of file's owner 6 rdev the device identifier (special files only) 7 size total size of file, in bytes 8 atimelas

Re: How to compare timestamp in two different files(regex)

2018-10-22 Thread Asad
Hi All , first hurdle is how do I extract this Feb 23 01:10:28 2018 from file1 which regex can I use ? convert it into epoch then regex for 02/23/18 01:10:33 is required ? convert into epoch So if you can suggest the correct regex for both t

Re: How to compare timestamp in two different files

2018-10-22 Thread Илья Рассадин
use Time::Piece; my $t1 = Time::Piece->strptime('Feb 23 01:10:28 2018', '%b %d %H:%M:%S %Y'); my $t2 = Time::Piece->strptime('02/23/18 01:10:33', '%m/%d/%y %H:%M:%S'); if ($t1 > $t2) { ... } On 23/10/2018 09:17, Asad wrote: Hi All ,         first hurdle is how do I extract this Feb 23 01:10:

RE: How to compare timestamp in two different files

2018-10-22 Thread Duncan Ferguson
timestamp in two different files Hi All , first hurdle is how do I extract this Feb 23 01:10:28 2018 from file1 which regex can I use ? convert it into epoch then regex for 02/23/18 01:10:33 is required ? convert into epoch So if you can

Re: How to compare timestamp in two different files

2018-10-22 Thread Asad
Hi All , first hurdle is how do I extract this Feb 23 01:10:28 2018 from file1 which regex can I use ? convert it into epoch then regex for 02/23/18 01:10:33 is required ? convert into epoch So if you can suggest the correct regex for both t

Re: How to compare timestamp in two different files

2018-10-22 Thread Asad
Thanks, I will do that. It was for perl . On Tue, Oct 23, 2018 at 10:42 AM Jim Gibson wrote: > On Oct 22, 2018, at 9:12 PM, Asad wrote: > > > > file1 : > > Patching tool version 12.1.0.2.0 Production on Fri Feb 23 01:10:28 2018 > > > > Bootstrapping registry and package to current versions...do

Re: How to compare timestamp in two different files

2018-10-22 Thread Jim Gibson
On Oct 22, 2018, at 9:12 PM, Asad wrote: > > file1 : > Patching tool version 12.1.0.2.0 Production on Fri Feb 23 01:10:28 2018 > > Bootstrapping registry and package to current versions...done > statement ERR-2001: table is corrupt check for cause > > could not determine the current status. >

How to compare timestamp in two different files

2018-10-22 Thread Asad
file1 : Patching tool version 12.1.0.2.0 Production on Fri Feb 23 01:10:28 2018 Bootstrapping registry and package to current versions...done statement ERR-2001: table is corrupt check for cause could not determine the current status. file2 : LOG file opened at 02/03/18 01:11:05 DUP-05004:

Re: Regex for matching files that don't have type extensions

2016-11-05 Thread Shawn H Corey
On Sat, 05 Nov 2016 21:30:12 + Aaron Wells wrote: > True. It could get hairy. Unicode is a pretty vast landscape, and I > think if you only want ASCII word characters to count as things that > could be in a filename, your original [A-Za-z0-9_] is your best bet. > Thanks to the others for thei

Re: Regex for matching files that don't have type extensions

2016-11-05 Thread Octavian Rasnita
From: Aaron Wells True. It could get hairy. Unicode is a pretty vast landscape, and I think if you only want ASCII word characters to count as things that could be in a filename, your original [A-Za-z0-9_] is your best bet. Thanks to the others for their comments. As Ken says: there are pro

Re: Regex for matching files that don't have type extensions

2016-11-05 Thread X Dungeness
On Sat, Nov 5, 2016 at 10:55 AM, Jovan Trujillo wrote: > Hi Aaron, >In perlre I read that \w > " > > \w[3] Match a "word" character (alphanumeric plus "_", plus > other connector punctuation chars plus > Unicode >

Re: Regex for matching files that don't have type extensions

2016-11-05 Thread Aaron Wells
True. It could get hairy. Unicode is a pretty vast landscape, and I think if you only want ASCII word characters to count as things that could be in a filename, your original [A-Za-z0-9_] is your best bet. Thanks to the others for their comments. As Ken says: there are probably more ways to code th

Re: Regex for matching files that don't have type extensions

2016-11-05 Thread Kent Fredric
On 6 November 2016 at 06:14, Jovan Trujillo wrote: > > 1207003PE_GM_09TNPLM2.csv > > I originally though m/[A-Za-z0-9\_]+/ would work, but it captures both > strings. > So then I tried m/[A-Za-z0-9\_]+(?!\.)/ but I still get both strings > captured. Alternatively, if your use case allows it, it m

Re: Regex for matching files that don't have type extensions

2016-11-05 Thread Ken Slater
Hi Jovan, On Sat, Nov 5, 2016 at 1:14 PM, Jovan Trujillo wrote: > Hi All, > I thought I could use a simple regex to match files like this: > > 1207003PE_GM_09TNPLM2 > > and ignore files with extensions like this: > > 1207003PE_GM_09TNPLM2.csv > > I

Re: Regex for matching files that don't have type extensions

2016-11-05 Thread Jovan Trujillo
ause it will only match if the entire string >> follows the pattern. Thanks! >> >> On Sat, Nov 5, 2016 at 10:14 AM, Jovan Trujillo < >> jovan.trujil...@gmail.com> wrote: >> >> Hi All, >> I thought I could use a simple regex to match files like

Re: Regex for matching files that don't have type extensions

2016-11-05 Thread Aaron Wells
; m/^[A-Za-z0-9_]+$/ works because it will only match if the entire string > follows the pattern. Thanks! > > On Sat, Nov 5, 2016 at 10:14 AM, Jovan Trujillo > wrote: > > Hi All, > I thought I could use a simple regex to match files like this: > > 1207003PE_GM_0

Re: Regex for matching files that don't have type extensions

2016-11-05 Thread Aaron Wells
n. Thanks! > > On Sat, Nov 5, 2016 at 10:14 AM, Jovan Trujillo > wrote: > > Hi All, > I thought I could use a simple regex to match files like this: > > 1207003PE_GM_09TNPLM2 > > and ignore files with extensions like this: > > 1207003PE_GM_09TNPLM2.csv &g

Re: Regex for matching files that don't have type extensions

2016-11-05 Thread Jovan Trujillo
Ah, I figured it out. m/^[A-Za-z0-9_]+$/ works because it will only match if the entire string follows the pattern. Thanks! On Sat, Nov 5, 2016 at 10:14 AM, Jovan Trujillo wrote: > Hi All, > I thought I could use a simple regex to match files like this: > > 1207003PE

Regex for matching files that don't have type extensions

2016-11-05 Thread Jovan Trujillo
Hi All, I thought I could use a simple regex to match files like this: 1207003PE_GM_09TNPLM2 and ignore files with extensions like this: 1207003PE_GM_09TNPLM2.csv I originally though m/[A-Za-z0-9\_]+/ would work, but it captures both strings. So then I tried m/[A-Za-z0-9\_]+(?!\.)/ but

Re: Where to put xs files?

2016-06-09 Thread sisyphus1
From: Alex Becker Sent: Thursday, June 09, 2016 4:45 AM To: beginners@perl.org Subject: Where to put xs files? Hi! Where do I put xs files in a module distribution? For example, the module Tk::IDElayout contains the following files: * CaptureRelease.pm * CaptureRelease.xs * WmCaptureRelease.c

Where to put xs files?

2016-06-08 Thread Alex Becker
Hi! Where do I put xs files in a module distribution? For example, the module Tk::IDElayout contains the following files: * CaptureRelease.pm * CaptureRelease.xs * WmCaptureRelease.c * WmCaptureRelease.h They are currently all located in the root folder of the module dist. If I would move the

feeding www:mechanize from a set of files

2016-03-09 Thread Luca Ferrari
Hi all, I'm building my own robot to do some stuff with a few interactive pages. Since I know that, after filling a form and hitting the button, I'll be redirected to another form/page to fill and so on for a few steps. What I would like to do is to test my robot against a static copy of the pages,

Re: scp_put failing when there are too many files

2015-12-29 Thread Salvador Fandino
On 12/11/2015 06:55 PM, Shlomi Fish wrote: Hi all, On Fri, 11 Dec 2015 11:07:54 -0500 Shawn H Corey wrote: On Fri, 11 Dec 2015 16:28:39 +0100 Ori Raz wrote: Hi, Did anyone encounter the scenario where scp_put is failing (too many arguments) when the directory contains too many files? We

Re: scp_put failing when there are too many files

2015-12-11 Thread Shawn H Corey
On Fri, 11 Dec 2015 19:55:15 +0200 Shlomi Fish wrote: > Of note here is Rob Pike's note about the argument list being limited > in size on UNIX-systems here: Yeah but usually it's a high number like 32767. :) -- Don't stop where the ink does. Shawn -- To unsubscribe, e-mail: beginne

Re: scp_put failing when there are too many files

2015-12-11 Thread Shlomi Fish
Hi all, On Fri, 11 Dec 2015 11:07:54 -0500 Shawn H Corey wrote: > On Fri, 11 Dec 2015 16:28:39 +0100 > Ori Raz wrote: > > > Hi, > > Did anyone encounter the scenario where scp_put is failing (too many > > arguments) when the directory contains too many files? &

Re: scp_put failing when there are too many files

2015-12-11 Thread Shawn H Corey
On Fri, 11 Dec 2015 16:28:39 +0100 Ori Raz wrote: > Hi, > Did anyone encounter the scenario where scp_put is failing (too many > arguments) when the directory contains too many files? > We have 36K files in the directory and it is failing... (with lower > amount it works fine) &

scp_put failing when there are too many files

2015-12-11 Thread Ori Raz
Hi, Did anyone encounter the scenario where scp_put is failing (too many arguments) when the directory contains too many files? We have 36K files in the directory and it is failing... (with lower amount it works fine) This is how we use it: $dr_node->scp_put( { recursive => 1, glo

Re: Spliting and creating small files from a main files based on line number

2015-03-25 Thread Jim Gibson
> On Mar 25, 2015, at 10:07 AM, Anirban Adhikary > wrote: > > Hi List > I have a configuration file and I would like to split the main file into > multiple small files and push the small temp. files into an array. My config > file looks like this > &

Re: Spliting and creating small files from a main files based on line number

2015-03-25 Thread Anirban Adhikary
next index value. On Wed, Mar 25, 2015 at 11:31 PM, Shlomi Fish wrote: > Hi Anirban, > > On Wed, 25 Mar 2015 22:37:39 +0530 > Anirban Adhikary wrote: > > > Hi List > > I have a configuration file and I would like to split the main file into > > multiple small fil

Re: Spliting and creating small files from a main files based on line number

2015-03-25 Thread Shlomi Fish
Hi Anirban, On Wed, 25 Mar 2015 22:37:39 +0530 Anirban Adhikary wrote: > Hi List > I have a configuration file and I would like to split the main file into > multiple small files and push the small temp. files into an array. My > config file looks like this > > GRC01

Spliting and creating small files from a main files based on line number

2015-03-25 Thread Anirban Adhikary
Hi List I have a configuration file and I would like to split the main file into multiple small files and push the small temp. files into an array. My config file looks like this GRC01;8;8;1;1;323U6_SIU-8;2048;2048;20;0;OFF GRC01;12;12;2;2;134S1_SIU-12;2048;2048;20;0;OFF GRC01;25;25;3;3;016S1_SIU

Re: Parsing multi column files

2015-01-18 Thread Mike
Thanks for quick lesson and pro-tips. I'll be sure to implement some of these. In case you were wondering, I am indeed using strict and warnings. diagnostics, too. Thanks again. On 1/18/15 9:05 PM, Brandon McCaig wrote: Mike: On Sun, Jan 18, 2015 at 07:00:05PM -0500, Mike wrote: So I've g

Re: Parsing multi column files

2015-01-18 Thread Brandon McCaig
Mike: On Sun, Jan 18, 2015 at 07:00:05PM -0500, Mike wrote: > So I've got a text file in a multi column format (three > columns), each column is separated by a single space. Here is a > snippet for reference: > > artless base-court apple-john > bawdy bat-fowling baggage > beslubbering beef-witted

Re: Parsing multi column files

2015-01-18 Thread Brandon McCaig
On Sun, Jan 18, 2015 at 07:24:21PM -0500, Shawn H Corey wrote: > my @line = ( > @first[rand(@first)], > @second[rand(@second)], > @third[rand(@third)], >); Sorry to beat on you, Shawn, but I missed this the first time around. T

Re: Parsing multi column files

2015-01-18 Thread Charles DeRykus
On Sun, Jan 18, 2015 at 4:00 PM, Mike wrote: > So I've got a text file in a multi column format (three columns), each > column is separated by a single space. Here is a snippet for reference: > > artless base-court apple-john > bawdy bat-fowling baggage > beslubbering beef-witted barnacle > > I wa

Re: Parsing multi column files

2015-01-18 Thread Mike
Thanks. I'll give this a shot. On 1/18/15 7:44 PM, Brandon McCaig wrote: On Sun, Jan 18, 2015 at 07:24:21PM -0500, Shawn H Corey wrote: You would need an array for each column: my $MAX = 10; my @first = (); my @second = (); my @third = (); sub get_columns { my $file = shift @_; o

Re: Parsing multi column files

2015-01-18 Thread Brandon McCaig
On Sun, Jan 18, 2015 at 07:24:21PM -0500, Shawn H Corey wrote: > You would need an array for each column: > > my $MAX = 10; > > my @first = (); > my @second = (); > my @third = (); > > sub get_columns { > my $file = shift @_; > > open my $fh, '<', $file or die "could not open $file: $!\

Re: Parsing multi column files

2015-01-18 Thread Shawn H Corey
On Sun, 18 Jan 2015 19:00:05 -0500 Mike wrote: > sub gen_ins { > open(FH, '<', 'insults2.txt') or die "[-] ERROR: Can't find > insult list."; > my @cols = split (" ", ); > print "$cols[0]"; > close FH; > } > > gen_ins(); > > When currently run, gen_ins() will print out the f

Parsing multi column files

2015-01-18 Thread Mike
So I've got a text file in a multi column format (three columns), each column is separated by a single space. Here is a snippet for reference: artless base-court apple-john bawdy bat-fowling baggage beslubbering beef-witted barnacle I want to be able to randomly select a word from the first col

Re: How does opendir/readdir process files

2015-01-15 Thread Brandon McCaig
On Thu, Jan 15, 2015 at 05:27:03PM -0500, Harry Putnam wrote: > Now I really have to ask what that even means. > > When Brandan said that to me... other than the RTFM it sailed > right over my head... so what does tl;dr mean? http://www.urbandictionary.com/define.php?term=tl%3Bdr Regards, --

Re: How does opendir/readdir process files

2015-01-15 Thread Shawn H Corey
On Thu, 15 Jan 2015 17:27:03 -0500 Harry Putnam wrote: > When Brandan said that to me... other than the RTFM it sailed right > over my head... so what does tl;dr mean? tl;dr == too long; didn't read -- Don't stop where the ink does. Shawn -- To unsubscribe, e-mail: beginners-unsubs

Re: How does opendir/readdir process files

2015-01-15 Thread Harry Putnam
John SJ Anderson writes: > On Tue, Jan 13, 2015 at 7:40 PM, Brandon McCaig wrote: >> Harry: >> >> (Expect typographical errors in such a long post...) >> >> tl;dr? RTFM. > Please don't tell people that. It's not helpful, it's not a helpful > attitude, and it's really not welcome here. > > The

Re: How does opendir/readdir process files

2015-01-14 Thread John SJ Anderson
On Tue, Jan 13, 2015 at 7:40 PM, Brandon McCaig wrote: > Harry: > > (Expect typographical errors in such a long post...) > > tl;dr? RTFM. Please don't tell people that. It's not helpful, it's not a helpful attitude, and it's really not welcome here. The rest of your post may be excellent, but I

Re: How does opendir/readdir process files

2015-01-14 Thread Shawn H Corey
On Tue, 13 Jan 2015 22:40:46 -0500 Brandon McCaig wrote: > my @files = map { $_->[0] } >sort { $a cmp $b } sort { $a->[1] <=> $b->[1] } >map {[$_, (stat("$dir/$_"))[9] ] } >

Re: How does opendir/readdir process files

2015-01-13 Thread Brandon McCaig
On Tue, Jan 13, 2015 at 10:40:46PM -0500, Brandon McCaig wrote: > to spend some quality time with The Revelant Manuals (TFM). I cite this as proof that I am TFT (too fucking tired). I'm not going to confess how proud I was of this word play before I realized that it was completely nonsensical. -t

Re: How does opendir/readdir process files

2015-01-13 Thread Brandon McCaig
Harry: (Expect typographical errors in such a long post...) tl;dr? RTFM. On Fri, Jan 09, 2015 at 08:26:55PM -0500, Harry Putnam wrote: > I'm taxing peoples patience I suppose but being considerably thick of > skull I cannot just look at this and see what it does. > > > my @

Re: How does opendir/readdir process files

2015-01-13 Thread Charles DeRykus
> ... > I think the normal and original behavior is no reference. I think > they added the reference in 5.14 too. Perhaps the documentation > just fails to mention that support for arrays was added in 5.14 > along with references? Hopefully I got that right this time. :) > Ah, RTFM would've helped

Re: How does opendir/readdir process files

2015-01-13 Thread Brandon McCaig
Charles: On Fri, Jan 09, 2015 at 11:02:28AM -0800, Charles DeRykus wrote: > Definitely needs a 'use 5.014' if you want to dabble. You appear to be correct. Hmmm, I didn't figure that from the documentation. Either I read it wrong or it's not documented well. > Apparently undocumented that you

Re: How does opendir/readdir process files

2015-01-09 Thread Harry Putnam
Dermot writes: First, thanks for you helpful input and examples. I'm taxing peoples patience I suppose but being considerably thick of skull I cannot just look at this and see what it does. > my @files = map { $_->[0] } >sort { $a cmp $b } >

Re: How does opendir/readdir process files

2015-01-09 Thread Charles DeRykus
On Fri, Jan 9, 2015 at 10:31 AM, Brandon McCaig wrote: > Charles: > > On Fri, Jan 9, 2015 at 12:46 PM, Charles DeRykus wrote: >> On Fri, Jan 9, 2015 at 3:39 AM, Dermot wrote: >>> I think John has answered your immediate question. >>> >>> ... >&g

Re: How does opendir/readdir process files

2015-01-09 Thread Brandon McCaig
Charles: On Fri, Jan 9, 2015 at 12:46 PM, Charles DeRykus wrote: > On Fri, Jan 9, 2015 at 3:39 AM, Dermot wrote: >> I think John has answered your immediate question. >> >> ... >> for (0..$#files) { >> print "$_) $files[$_]\n"; >> } >>

Re: How does opendir/readdir process files

2015-01-09 Thread Charles DeRykus
On Fri, Jan 9, 2015 at 3:39 AM, Dermot wrote: > I think John has answered your immediate question. > > ... > for (0..$#files) { > print "$_) $files[$_]\n"; > } > Alternatively (at least since 5.14) : say "$k) $v" while ($k,$v) = each @files; -- Ch

Re: How does opendir/readdir process files

2015-01-09 Thread Dermot
I think John has answered your immediate question. If you want to get the files back in a particular order you should include a sort between and grep readdir. An example might be my @files = sort { $a cmp $b } grep { ! /^\./ && -f "$dir/$_" } readdir($dh

Re: How does opendir/readdir process files

2015-01-08 Thread John SJ Anderson
On Thu, Jan 8, 2015 at 5:52 PM, Harry Putnam wrote: > Opening a directory and readdir with a grep in there to find specific > filenames, how does that process collect the files? See http://www.perlmonks.org/?node_id=533744 tl;dr: it depends on your OS. > I mean will the generated @ar

How does opendir/readdir process files

2015-01-08 Thread Harry Putnam
Opening a directory and readdir with a grep in there to find specific filenames, how does that process collect the files? I mean will the generated @ar of files be oldest first or someother reliable order? Using an example paraphrased from perldoc -f readdir: (I changed the regex) opendir(my

Re: share a variable between files

2014-10-09 Thread Shawn H Corey
On Wed, 8 Oct 2014 21:36:06 +0200 Hans Ginzel wrote: > I want to use one global hash variable for options or configuration > variables like verbose, debug. I don't want to pass them to each > function or to almost each object. package main; our %Opts = ( verbose => 0, debug => 0. ); # yo

Re: share a variable between files

2014-10-09 Thread Hans Ginzel
On Thu, Oct 09, 2014 at 03:50:02AM +1300, Kent Fredric wrote: First, what are you trying to acheive. Global variables are rarely a good idea, as is sharing variables between files. So the question is, why are you trying to share a variable between files using globals? My suggestion

Re: share a variable between files

2014-10-08 Thread Kent Fredric
On 9 October 2014 08:36, Hans Ginzel wrote: > I want to use one global hash variable for options or configuration > variables > like verbose, debug. I don't want to pass them to each function > or to almost each object. > Indeed, Jim Gibson explains you can simply declare

Re: share a variable between files

2014-10-08 Thread Jim Gibson
The ‘our’ statement associates a simple name with a package global variable in the current package. Therefore, if you want to make $var in file b.pl mean the package global variable $var in package a ($a:var), just put ‘our $var;’ after the ‘package a;’ statement in file b.pl (see below). On Oc

Re: share a variable between files

2014-10-08 Thread Kent Fredric
ariable from that package > (=namespace). > > Thank you > First, what are you trying to acheive. Global variables are rarely a good idea, as is sharing variables between files. So the question is, why are you trying to share a variable between files using globals? My suggestion

share a variable between files

2014-10-08 Thread Hans Ginzel
Hello! Let's consider following strip-down example: # file a.pl use strict; package a; our $var=1; warn "var=$var"; # file b.pl use strict; #no strict qw/vars/; require 'b.pl'; package a; warn "var=$var"; How to get rid of "no strict qw/vars/;" to not get message "Global symbol "$var" requires

Re: Using Files in Chronological Order

2014-01-27 Thread Paul Johnson
On Fri, Jan 24, 2014 at 06:26:58AM -0600, Martin G. McCormick wrote: > This is a perl philosophy question. I need to look for > some files, newest first. If I use the glob directive in perl, I > can fill an array with all the file names that match the pattern > but they aren&#x

Re: Using Files in Chronological Order

2014-01-27 Thread Shawn H Corey
provided you accept its limitations. But why not? @files = sort { (stat($a))[9] <=> (stat($b))[9] || lc($a) cmp lc($b) || $a cmp $b } glob( 'filenames*' ); -- Don't stop where the ink does. Shawn -- To unsubscr

Using Files in Chronological Order

2014-01-27 Thread Martin G. McCormick
This is a perl philosophy question. I need to look for some files, newest first. If I use the glob directive in perl, I can fill an array with all the file names that match the pattern but they aren't sorted in to chronological order. I found a perlmonks posting in which the same que

Re: Locating files in sub-directories

2013-12-17 Thread Octavian Rasnita
s in > /home/ss_files. The directory won't change once the script is installed. Both shop.cgi and the ss_files directory are in the surfshop directory and will always remain there. The surfshop directory could, in theory, be placed anywhere, but that shouldn't have any eff

Re: Locating files in sub-directories

2013-12-17 Thread SSC_perl
it will search for modules in > /home/ss_files. The directory won't change once the script is installed. Both shop.cgi and the ss_files directory are in the surfshop directory and will always remain there. The surfshop directory could, in theory, be placed anywhere, but that

Re: Locating files in sub-directories

2013-12-16 Thread Octavian Rasnita
From: "SSC_perl" I'm in the process of moving certain files of the SurfShop script into a sub-directory to clean up the main directory and would like to know the best way for the script to find these files. I was using this method: use FindBin qw($Bin); use lib "$Bin/

Locating files in sub-directories

2013-12-16 Thread SSC_perl
I'm in the process of moving certain files of the SurfShop script into a sub-directory to clean up the main directory and would like to know the best way for the script to find these files. I was using this method: use FindBin qw($Bin); use lib "$Bin/../ss_files"

Re: sha-2 sum of files?

2013-06-14 Thread lee
Shlomi Fish writes: >> > But if the size hasn't changed, then you still need to check something >> > else. You can do another light check, or decide to do the heavy one. >> > >> > This is also important because a hash-value is only a fingerprint, so >

Re: the perl script (SOLVED: sha-2 sum of files?)

2013-06-14 Thread lee
s it would fail with an error along the lines that an undefined value cannot be printed (joined since I changed that) with others. Working with non-existing files is actually a glitch in the script atm because when gethash() returns '~' and that is put into the hashs.list, next time w

Re: sha-2 sum of files?

2013-06-14 Thread lee
Jim Gibson writes: > On Jun 13, 2013, at 1:30 PM, lee wrote: > >> In my application, my estimate is that there will be a set of around >> 100--150 files. Once a file is closed and reported one last time, it >> doesn't need to be considered anymore, so the number of

Re: the perl script (SOLVED: sha-2 sum of files?)

2013-06-14 Thread Jim Gibson
le. > > It has one problem: The list of closed files can grow indefinitely, and > since the script checks whether a file that has been closed is already > listed, performance will degrade with the number of files on the closed > list increasing. This check isn't exactly needed an

Re: sha-2 sum of files?

2013-06-14 Thread Dr.Ruud
On 14/06/2013 08:02, Shlomi Fish wrote: On Thu, 13 Jun 2013 22:51:24 +0200 lee wrote: How likely is it that the hash is the same though the file did change? Well, if you take SHA-256 for example, then its hash has 256 bits so you have a chance of 1 / (2**256) that two non-identical byte vec

Re: sha-2 sum of files?

2013-06-13 Thread Shlomi Fish
hanged, then you still need to check something > > else. You can do another light check, or decide to do the heavy one. > > > > This is also important because a hash-value is only a fingerprint, so > > different files have (a small chance on having) the same hash value. &g

the perl script (SOLVED: sha-2 sum of files?)

2013-06-13 Thread lee
Hi, so I've done this script now --- my fourth perl script ever --- and since I'm getting so much help here, I thought I'd post it here. I'm sure it could be done much better, it's just plain and simple. It has one problem: The list of closed files can grow indefinit

Re: sha-2 sum of files?

2013-06-13 Thread Shlomi Fish
Hi David, On Thu, 13 Jun 2013 21:30:00 -0700 David Christensen wrote: > On 06/13/13 01:41, Shlomi Fish wrote: > > 1. You're lacking strict and warnings: > > 2. You're looping using $_ : > > 3. You're using md5_hex by slurping the contents of the file into memory, > > 4. read_file was not explict

Re: sha-2 sum of files?

2013-06-13 Thread David Christensen
On 06/13/13 01:41, Shlomi Fish wrote: 1. You're lacking strict and warnings: 2. You're looping using $_ : 3. You're using md5_hex by slurping the contents of the file into memory, 4. read_file was not explictly imported from File::Slurp: Both the Perl Cookbook and Programming Perl are showing the

Re: sha-2 sum of files?

2013-06-13 Thread Jim Gibson
On Jun 13, 2013, at 1:30 PM, lee wrote: > In my application, my estimate is that there will be a set of around > 100--150 files. Once a file is closed and reported one last time, it > doesn't need to be considered anymore, so the number of relevant files > is limited. Each f

Re: sha-2 sum of files?

2013-06-13 Thread lee
>> >>> The first thing to do would be to check the file size. If the file >>> size has changed, then the file has been modified. So you will want to >>> save the file size. >> >> The file might be modified without changing its size ... >> >>>

Re: sha-2 sum of files?

2013-06-13 Thread lee
is also important because a hash-value is only a fingerprint, so > different files have (a small chance on having) the same hash value. > > The file size check makes the chance even smaller that you don't > detect the change. Hm ok, this kinda sucks ... Imagine I check size and

split() (Re: sha-2 sum of files?)

2013-06-13 Thread lee
Jim Gibson writes: > On Jun 13, 2013, at 10:51 AM, lee wrote: >> + When I create files with lines like "filename:size:mtime" or >> "filename:hash", is there something built in to read a syntax like >> this into, let's say, an array like "my @f

  1   2   3   4   5   6   7   8   9   10   >