[26673] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8780 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 20 14:05:31 2005

Date: Tue, 20 Dec 2005 11:05:06 -0800 (PST)
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, 20 Dec 2005     Volume: 10 Number: 8780

Today's topics:
        getting info from a bash shell script into perl variabl <bob@dont.spam.me>
    Re: How to give (put to browser) someone PDF document,  <tadmc@augustmail.com>
    Re: newbie ques <BZ@caradhras.net>
    Re: quotes <tadmc@augustmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 20 Dec 2005 18:53:20 GMT
From: Bob <bob@dont.spam.me>
Subject: getting info from a bash shell script into perl variables
Message-Id: <pan.2005.12.20.18.53.19.931919@dont.spam.me>

Hello,

This is a newbie question.

I have a perl script that needs to set some variables based on the output
of a bash shell script. I can arrange the output of the shell script to
whatever works best for perl.

Here is what I have so far:

Output of shell script:

	$var1="aaa"; $var2="bbb ccc"; $var3="";

Perl extract:

	my $var1; my $var2; my $var3;
	eval `./myscript.sh`;
	print "var1=$var1";
	print "var2=$var2";
	print "var3=$var3";

This always prints:

	var1=
	var2=
	var3=

So, am I using eval incorrectly?

Is there a better way to get the output of the shell script onto variables
(or into an array which I can also work with instead of individual
variables)?

Bob



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

Date: Tue, 20 Dec 2005 08:11:37 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How to give (put to browser) someone PDF document, with hidden path to document.
Message-Id: <slrndqg48p.7n6.tadmc@magna.augustmail.com>

MAX <max@max.hr> wrote:

> How to give (put to browser) someone PDF document, with hidden path to
> document.


print() the appropriate headers to STDOUT
open() the file
binmode() the input and output filehandles
readline() from the file and print() to STDOUT
close() the file


> Perl script work on Microsoft IIS server and that cud be problem if I wont
> to use password on folder.


If you tell us how that is a problem, then we might be able
to help you solve it...


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 15 Dec 2005 18:42:23 GMT
From: BZ <BZ@caradhras.net>
Subject: Re: newbie ques
Message-Id: <slrndq3e8f.oe2.BZ@ophelia.vpn.zoetekouw.net>

Madhu Ramachandran wrote in comp.lang.perl.misc:
>  i want to look for xml tokens.. like <token> .. the pattern matching doesnt 
>  seem to work when i have < and >.. i tried escaping < and > with a \ , but 
>  no use..
>  $inp=<STDIN>;
>  if ($inp =~ /\b\<[a-z]+\>\b/) {
>    print ("SUCCESS inp has <sometoken> \n");
>  }

That's because \< and \> match word boundaries, not < and >
characters.

You should know though, that xml parsing by means of regular
expressions can't be done (or at least, not very easily).  You really
should be using a real XML parser.

-- 
BZ


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

Date: Tue, 20 Dec 2005 08:00:59 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: quotes
Message-Id: <slrndqg3kr.7n6.tadmc@magna.augustmail.com>

Raghuramaiah Gompa <rgompa@steel.ucs.indiana.edu> wrote:
> I am "trying" to write a perl code to generate a file
> with everybody's 'help'.
> 
> The output should be:


What should the input be?


> I am \myquote{trying} to write a perl code to generate a 
> file with everybody{\justquote}s \singlequote{help}.


Oh, the unlabeled paragraph at the beginning is supposed to be 
the input I guess.

Why make us guess? Please be a bit more considerate of other
people's time.

Have you seen the Posting Guidelines that are posted here frequently?


> I know I can handle double quotes, but I am puzzled about 
> single quote as you can see they may occur two different 
> ways.


Natural Language Processing is hard, but I'll give 
it "the ol' college try" (my solution will fail on this very
sentence though, 'cause of the apostrophes).


--------------------
#!/usr/bin/perl
use warnings;
use strict;

$_ = q(I am "trying" to write a perl code to generate a file )
   . q(with everybody's 'help'.);

s/  " ([^"]+) "/\\myquote{$1}/x;
s/\b ' \b      /{\\justquote}/x;
s/  ' ([^']+) '/\\singlequote{$1}/x;

print "$_\n";
--------------------


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

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 V10 Issue 8780
***************************************


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