Re: Accessing packed data structures

2007-03-13 Thread Dharshana Eswaran
On 3/14/07, Chas Owens <[EMAIL PROTECTED]> wrote: On 3/14/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: snip > Now how do i come up with the pack template? I dont know how a enum should > be represented in the pack template. :-( > > /I8(enum)I8i8I8/ => pack template > > The above mentioned en

Re: Accessing packed data structures

2007-03-13 Thread Chas Owens
On 3/14/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: snip Now how do i come up with the pack template? I dont know how a enum should be represented in the pack template. :-( /I8(enum)I8i8I8/ => pack template The above mentioned enum just contains two elements. The data which i need to pack

Re: Accessing packed data structures

2007-03-13 Thread Dharshana Eswaran
On 3/13/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: On 3/13/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: > I was going thro the topic "Accessing packed data structures" in the Perl > Complete Reference Book. I came across this example: > > struct utmp { > char ut_user[8]; /* User login name

Re: Question about system call

2007-03-13 Thread Chas Owens
On 3/13/07, Paul <[EMAIL PROTECTED]> wrote: On Tue, March 13, 2007 2:38 am, yitzle wrote: > Where you doing "rm -f $file" or `rm -f $file`? > You need to use "backticks" for system commands. If memory serves me, back ticks are only needed inside a system command for UNIX commands and regular tic

Re: Sorting an Array of Arrays

2007-03-13 Thread Mumia W.
On 03/13/2007 07:44 PM, Hardly Armchair wrote: Hello List, I have a data structure containing a bunch of strings in different groups: [...] I want these sorted first alphabetically within the group, and then according to the number of member in the group. [...] This is slightly more compact

Re: Sorting an Array of Arrays

2007-03-13 Thread John W. Krahn
Hardly Armchair wrote: > Hello List, Hello, > I have a data structure containing a bunch of strings in different groups: > > $groups = [ > [ > 'SSPDQR', > 'SSPSDR', > 'STSSER', > ], > [ > 'CSANLH', >

Sorting an Array of Arrays

2007-03-13 Thread Hardly Armchair
Hello List, I have a data structure containing a bunch of strings in different groups: $groups = [ [ 'SSPDQR', 'SSPSDR', 'STSSER', ], [ 'CSANLH', 'CVANRD', ], [...],

Re: Question about system call

2007-03-13 Thread Paul
On Tue, March 13, 2007 2:38 am, yitzle wrote: > Where you doing "rm -f $file" or `rm -f $file`? > You need to use "backticks" for system commands. If memory serves me, back ticks are only needed inside a system command for UNIX commands and regular ticks specifying the system command within the Pe

Re: Control Characters

2007-03-13 Thread Dr.Ruud
"Shawn Milo" schreef: > If I pipe the output of the file to "od -c" on the command line, the > other control characters (which are already correct in the file) seem > to come through as their octal value. However, most attempts to > convert the \n into a ^J seem to end up with Perl interpreting i

Re: Automating a perl script by another perl script

2007-03-13 Thread Dr.Ruud
Jeff Pang schreef: > perl -e 'print while(<>)' < /etc/passwd That (is not an answer to OP's question, but) can also be written as: perl -pe1 /etc/passwd and even as cat /etc/passwd -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional com

Re: Accessing packed data structures

2007-03-13 Thread John W. Krahn
Tom Phoenix wrote: > On 3/13/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: > >> I was going thro the topic "Accessing packed data structures" in the Perl >> Complete Reference Book. I came across this example: >> >> struct utmp { >> char ut_user[8]; /* User login name */ >> char ut_id[4]; /* /e

Re: seeking pedagogic advice

2007-03-13 Thread Jeni Zundel
oh - forgot to also request: could you include your reasons why you might recommend a specific path? Helps me evaluate which learning path is right for me. thanks again, Jen Jeni Zundel wrote: I've been attempting to learn perl for about a month so far. I've taken the 4th Edition of L

seeking pedagogic advice

2007-03-13 Thread Jeni Zundel
I've been attempting to learn perl for about a month so far. I've taken the 4th Edition of Learning Perl and I work through a chapter every few days. I just found an online resource at perl.org called Beginning Perl. I've used a few chapters out of this book; it's interesting to see the

Re: Control Characters

2007-03-13 Thread Rob Dixon
Chas Owens wrote: On 3/13/07, Shawn Milo <[EMAIL PROTECTED]> wrote: How can I get Perl to spit out control characters, such as ^J (the linefeed) as the actual control character? Every time I try to print it, Perl converts it to the ASCII \n character. I need to process a file, converting a \n

Re: Removing blank lines

2007-03-13 Thread Rob Dixon
Grant wrote: >> > In this instance I have two blank lines in the delivered HTML between >> > htmltag1 and htmltag2: >> > >> > >> > [ictag][/ictag] >> > [ictag][/ictag] >> > >> > >> > If I use the filter like this: >> > >> > [filter no_white] >> > [ictag][/ictag] >> > [ictag][/ictag] >> > [/fil

Re: Control Characters

2007-03-13 Thread Chas Owens
On 3/13/07, Bill Jones <[EMAIL PROTECTED]> wrote: snip In answer to your question, for example under VIM, the ^@ the other poster is seeing is actually \n (which is what the OP wants) -- but I am in my own Universe =) So, when I hit ^V^J VIM displays ^@ snip That must be an artifact of Vim

parse for two regexes

2007-03-13 Thread Matt Herzog
Hi All. I'm trying to either strip everything outside the tags or match everything inside them for three nearly identical web pages. I need the content of the pages minus header/footer. Ultimately I need to glue them all together into one valid html doc but that's for later. In general, should

Re: Removing blank lines

2007-03-13 Thread Grant
> > while( ) { > > push @out, $_ if /\S/; > > } snip > Is that better than: > > push @out, $_ unless /^\s*$/; snip They are functionally equivalent, but (at least on the version of perl I have) /\S/ is faster: Ok, I'll switch. Thanks. - Grant -- To unsubscribe, e-mail: [EMAIL PROTEC

Re: Automating a perl script by another perl script

2007-03-13 Thread Neal Clark
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 you could also give this a try: http://search.cpan.org/~rgiersig/Expect-1.20/Expect.pod On Mar 13, 2007, at 5:41 AM, Nath, Alok (STSD) wrote: Hi, I have a perl script which prompts user for certain inputs. I want to automate this by creating

Re: Removing blank lines

2007-03-13 Thread Chas Owens
On 3/13/07, Grant <[EMAIL PROTECTED]> wrote: snip > while( ) { > push @out, $_ if /\S/; > } snip Is that better than: push @out, $_ unless /^\s*$/; snip They are functionally equivalent, but (at least on the version of perl I have) /\S/ is faster: mix: Rate /^\s*$//\S/

Re: Removing blank lines

2007-03-13 Thread Grant
>> > In this instance I have two blank lines in the delivered HTML between >> > htmltag1 and htmltag2: >> > >> > >> > [ictag][/ictag] >> > [ictag][/ictag] >> > >> > >> > If I use the filter like this: >> > >> > [filter no_white] >> > [ictag][/ictag] >> > [ictag][/ictag] >> > [/filter] >> > >> >

Re: Removing blank lines

2007-03-13 Thread Rob Dixon
Grant wrote: > In this instance I have two blank lines in the delivered HTML between > htmltag1 and htmltag2: > > > [ictag][/ictag] > [ictag][/ictag] > > > If I use the filter like this: > > [filter no_white] > [ictag][/ictag] > [ictag][/ictag] > [/filter] > > I get only one blank line, so it i

Re: Removing blank lines

2007-03-13 Thread Grant
> while( ) { > push @out, $_; > } > Can anyone show me how to regexp the blank lines out > considering the above code? Do you mean this? while () { push @out, $_ unless /^\s*$/; } Or, what do you really mean by "blank"? Hope this helps! Help? Well, it completely fixed the pro

Re: Control Characters

2007-03-13 Thread Bill Jones
On 3/13/07, Bill Jones <[EMAIL PROTECTED]> wrote: 000005000 002 000 \0 \n 002 Erm, make that: od -b xxx is - 000 000 012 002 -- WC (Bill) Jones -- http://youve-reached-the.endoftheinternet.org/ http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0x2A46CF

Re: Control Characters

2007-03-13 Thread Bill Jones
On 3/13/07, Rob Dixon <[EMAIL PROTECTED]> wrote: Unless I'm in a different parallel universe this doesn't make sense at all! What tests have you done Bill? How is ^@ (a null or zero byte) equal to "\n"? How is control-J two bytes? I thought it was pretty much defined as the character consisti

Re: Accessing packed data structures

2007-03-13 Thread Tom Phoenix
On 3/13/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: I was going thro the topic "Accessing packed data structures" in the Perl Complete Reference Book. I came across this example: struct utmp { char ut_user[8]; /* User login name */ char ut_id[4]; /* /etc/inittab id */ char ut_line[12]; /*

Re: Removing blank lines

2007-03-13 Thread Tom Phoenix
On 3/13/07, Grant <[EMAIL PROTECTED]> wrote: while( ) { push @out, $_; } Can anyone show me how to regexp the blank lines out considering the above code? Do you mean this? while () { push @out, $_ unless /^\s*$/; } Or, what do you really mean by "blank"? Hope this helps! --To

Re: Removing blank lines

2007-03-13 Thread Grant
> In this instance I have two blank lines in the delivered HTML between > htmltag1 and htmltag2: > > > [ictag][/ictag] > [ictag][/ictag] > > > If I use the filter like this: > > [filter no_white] > [ictag][/ictag] > [ictag][/ictag] > [/filter] > > I get only one blank line, so it is an improveme

Re: Removing blank lines

2007-03-13 Thread Chas Owens
On 3/12/07, Grant <[EMAIL PROTECTED]> wrote: snip In this instance I have two blank lines in the delivered HTML between htmltag1 and htmltag2: [ictag][/ictag] [ictag][/ictag] If I use the filter like this: [filter no_white] [ictag][/ictag] [ictag][/ictag] [/filter] I get only one blank line

Re: Control Characters

2007-03-13 Thread Rob Dixon
Shawn Milo wrote: On 3/13/07, Bill Jones <[EMAIL PROTECTED]> wrote: My tests all show that ^@ is not null but the \n you want. Control-J is two bytes: \0 \n Under C the \0\n is a End-Of-String indicator -- required to differentiate it from numbers, etc. HTH/Sx =) -- WC (Bill) Jones -- htt

Re: Control Characters

2007-03-13 Thread Chas Owens
On 3/13/07, Shawn Milo <[EMAIL PROTECTED]> wrote: How can I get Perl to spit out control characters, such as ^J (the linefeed) as the actual control character? Every time I try to print it, Perl converts it to the ASCII \n character. I need to process a file, converting a \n to \cJ, AKA the ^J

Re: Control Characters

2007-03-13 Thread Rob Dixon
Shawn Milo wrote: How can I get Perl to spit out control characters, such as ^J (the linefeed) as the actual control character? Every time I try to print it, Perl converts it to the ASCII \n character. I need to process a file, converting a \n to \cJ, AKA the ^J character. I've tried various th

Re: Control Characters

2007-03-13 Thread Shawn Milo
On 3/13/07, Bill Jones <[EMAIL PROTECTED]> wrote: My tests all show that ^@ is not null but the \n you want. Control-J is two bytes: \0 \n Under C the \0\n is a End-Of-String indicator -- required to differentiate it from numbers, etc. HTH/Sx =) -- WC (Bill) Jones -- http://youve-reached-t

Re: Automating a perl script by another perl script

2007-03-13 Thread Chas Owens
On 3/13/07, Nath, Alok (STSD) <[EMAIL PROTECTED]> wrote: Hi, I have a perl script which prompts user for certain inputs. I want to automate this by creating a separate script which runs the above perl file and probably passing the inputs in a separate text file. Can anybody give me s

Control Characters

2007-03-13 Thread Shawn Milo
How can I get Perl to spit out control characters, such as ^J (the linefeed) as the actual control character? Every time I try to print it, Perl converts it to the ASCII \n character. I need to process a file, converting a \n to \cJ, AKA the ^J character. I've tried various things with sprintf,

Re: Automating a perl script by another perl script

2007-03-13 Thread Jeff Pang
How about this thought? perl -e 'print while(<>)' < /etc/passwd This would print the content in /etc/passwd file. Here I just use shell's "<" symbol to pass the file's content to perl script. -Original Message- >From: "Nath, Alok (STSD)" <[EMAIL PROTECTED]> >Sent: Mar 13, 2007 8:41 PM

RE: What module should I use for this: SOAP, XML?

2007-03-13 Thread Zembower, Kevin
Jenda and Chas, thank you both for your suggestions. I thought that it might involve both LWP and XML modules, but I thought it would be much more complicated than either of your suggestions. Thank you for teaching me the simplicity of these operations. -Kevin -Original Message- From: Jen

Re: Removing blank lines

2007-03-13 Thread Rob Dixon
Grant wrote: >> $val =~ s/^\s*\n//mg; > > I'm not having any luck there either. I'm not sure what is actually > creating the blank lines. It could be spaces, tabs, or some other > blank line creator. The \s marker will match all of those. Can you show us your code please? Don't forget that y

Automating a perl script by another perl script

2007-03-13 Thread Nath, Alok (STSD)
Hi, I have a perl script which prompts user for certain inputs. I want to automate this by creating a separate script which runs the above perl file and probably passing the inputs in a separate text file. Can anybody give me some pointers or how to do this ? Thanks Alok. -- To

Re: Question about system call

2007-03-13 Thread Ken Foskey
On Tue, 2007-03-13 at 02:29 -0400, Mathew wrote: > I recently forgot about the unlink function and had been trying to > remove files using the less efficient system call to run "rm -f > /path/to/files". I found, however, that this didn't work at all. > > I've since replaced it with unlink and get

Accessing packed data structures

2007-03-13 Thread Dharshana Eswaran
Hi all, I was going thro the topic "Accessing packed data structures" in the Perl Complete Reference Book. I came across this example: struct utmp { char ut_user[8]; /* User login name */ char ut_id[4]; /* /etc/inittab id */ char ut_line[12]; /* device name */ short ut_pid; /* process ID */ shor

Re: Question about system call

2007-03-13 Thread Madan Kumar Nath
Hello, 1. Check that the "rm" command is not mapped to "rm -i" or similar alias. if so them the "rm -f" command from system() command will not work. Thanx Madan Mathew wrote: I recently forgot about the unlink function and had been trying to remove files using the less effic