[29854] in Perl-Users-Digest
Perl-Users Digest, Issue: 1097 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 7 16:09:43 2007
Date: Fri, 7 Dec 2007 13:09:09 -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 Fri, 7 Dec 2007 Volume: 11 Number: 1097
Today's topics:
Re: /e modifier to s///; short "1 liner" ? <test of sol (Name withheld by request)
Re: /e modifier to s///; short "1 liner" ? <Thx for sol (Name withheld by request)
Re: /e modifier to s///; short "1 liner" ? (Name withheld by request)
Re: /e modifier to s///; short "1 liner" ? xhoster@gmail.com
Re: Doing the Impossible? :: Is there anyway to access <steve.moody@philips.com>
Re: Doing the Impossible? :: Is there anyway to access <ben@morrow.me.uk>
Re: Doing the Impossible? :: Is there anyway to access <steve.moody@philips.com>
Doing the Impossible? :: Is there anyway to access cust <steve.moody@philips.com>
Re: Doing the Impossible? :: Is there anyway to access <glex_no-spam@qwest-spam-no.invalid>
Re: Doing the Impossible? :: Is there anyway to access <glex_no-spam@qwest-spam-no.invalid>
Re: How to parse out specific data in text files and pl cyrusgreats@gmail.com
Re: How to parse out specific data in text files and pl cyrusgreats@gmail.com
Re: How to parse out specific data in text files and pl <ben@morrow.me.uk>
Re: How to parse out specific data in text files and pl cyrusgreats@gmail.com
Re: How to parse out specific data in text files and pl <glex_no-spam@qwest-spam-no.invalid>
Re: How to parse out specific data in text files and pl <glex_no-spam@qwest-spam-no.invalid>
passing arguments to a shell script from a perl script <doni.sekar@gmail.com>
Re: passing arguments to a shell script from a perl scr <StaminaJ@nowhere.com>
Re: passing arguments to a shell script from a perl scr <smallpond@juno.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 07 Dec 2007 20:47:39 GMT
From: anonb6e9@nyx.net (Name withheld by request)
Subject: Re: /e modifier to s///; short "1 liner" ? <test of soln, works fine>
Message-Id: <1197060459.357109@irys.nyx.net>
per your suggestion:
$ echo 'a b Dec 9 c d'|perl -lpe 's/(Dec)(\s+)(\d+)/sprintf "$1$2%d",$3 + 5/e;'
a b Dec 14 c d
works just fine
------------------------------
Date: 07 Dec 2007 20:35:08 GMT
From: anonb6e9@nyx.net (Name withheld by request)
Subject: Re: /e modifier to s///; short "1 liner" ? <Thx for soln>
Message-Id: <1197059707.966779@irys.nyx.net>
--snip
>> > $ echo 'Dec 9'|perl -lpe 's/(Dec)(\s+)(\d+)/printf "$1$2 %d--huh?:",
>> > $3 + 5;/e;'
>> > Dec 14--huh?:1
>> >
>> >How do I get rid of the "1" in "--huh?:1". Also why is the "1" there?
>>
>> still not sure we the "1" is coming from
>
>The evaluation of the printf has both a side-effect and a value.
>The side effect is the printing of 'Dec 14--huh?:'. The return
>value is "1", for success. The part of the thing in $_ that matched gets
>replaced with this "1", because that is what s///e does. Due to the -p
>switch, the value of $_ at the end of the implicit loop, namely "1", gets
>printed.
Thanks for the detailed explanation.
--snip
>You should probably use sprintf. sprintf returns the formatted string,
>and that return value would then get substituted into $_. printf doesn't
>return the formatted string, it prints it to some filehandle and then
>returns "1" upon success.
Thanks again
------------------------------
Date: 07 Dec 2007 19:55:01 GMT
From: anonb6e9@nyx.net (Name withheld by request)
Subject: Re: /e modifier to s///; short "1 liner" ?
Message-Id: <1197057301.60882@irys.nyx.net>
In article <4759904e$0$11892$afc38c87@>,
Name withheld by request <anonb6e9@nyx3.nyx.net> wrote:
>Pls consider:
>
> $ echo 'Dec 9'|perl -lpe 's/(Dec)(\s+)(\d+)/printf "$1$2 %d--huh?:",$3 + 5;/e;'
> Dec 14--huh?:1
>
>How do I get rid of the "1" in "--huh?:1". Also why is the "1" there?
still not sure we the "1" is coming from
>If there is a cleaner approach to the above 1 liner, that would be fine
>also - I just want preserve the rest of the input,
>and add an integer offset to the date.
I was not thinking about the -p switch very clearly...
This works for me:
$ echo 'a b c Dec 9 d e f'|perl -lne 's/^(.*?)(Dec)(\s+)(\d+)(.*)$/printf "$1$2$3 %d$5\n",$4 + 5/e;'
a b c Dec 14 d e f
------------------------------
Date: 07 Dec 2007 20:12:29 GMT
From: xhoster@gmail.com
Subject: Re: /e modifier to s///; short "1 liner" ?
Message-Id: <20071207151230.225$NV@newsreader.com>
anonb6e9@nyx.net (Name withheld by request) wrote:
> In article <4759904e$0$11892$afc38c87@>,
> Name withheld by request <anonb6e9@nyx3.nyx.net> wrote:
> >Pls consider:
> >
> > $ echo 'Dec 9'|perl -lpe 's/(Dec)(\s+)(\d+)/printf "$1$2 %d--huh?:",
> > $3 + 5;/e;'
> > Dec 14--huh?:1
> >
> >How do I get rid of the "1" in "--huh?:1". Also why is the "1" there?
>
> still not sure we the "1" is coming from
The evaluation of the printf has both a side-effect and a value.
The side effect is the printing of 'Dec 14--huh?:'. The return
value is "1", for success. The part of the thing in $_ that matched gets
replaced with this "1", because that is what s///e does. Due to the -p
switch, the value of $_ at the end of the implicit loop, namely "1", gets
printed.
> >If there is a cleaner approach to the above 1 liner, that would be fine
> >also - I just want preserve the rest of the input,
> >and add an integer offset to the date.
You should probably use sprintf. sprintf returns the formatted string,
and that return value would then get substituted into $_. printf doesn't
return the formatted string, it prints it to some filehandle and then
returns "1" upon success.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Fri, 7 Dec 2007 08:50:52 -0800 (PST)
From: SteveM <steve.moody@philips.com>
Subject: Re: Doing the Impossible? :: Is there anyway to access custom .Net DLLs from within Perl
Message-Id: <0cef6587-972a-4cae-bbe4-1a04107b2ba3@d27g2000prf.googlegroups.com>
On Dec 7, 8:39 am, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
wrote:
> SteveM wrote:
> > I am thinking from my research that this is probably one of those
> > things that just can not be done,
>
> Hu.. maybe I don't understand, but searching for "perl 'accessing dll'"
> on my favorite Internet search engine showed many links about how
> to do this. One of them showed using Win32::API:
>
> http://search.cpan.org/~cosimo/Win32-API-0.47/API.pm
>
> "With this module you can import and call arbitrary functions from
> Win32's Dynamic Link Libraries (DLL), without having to write an XS
> extension. Note, however, that this module can't do anything (parameters
> input and output is limited to simpler cases), and anyway a regular XS
> extension is always safer and faster."
>
> Otherwise, you should be able to access it via an XS extension.
Actually I saw these posts, and believe it or not I did spend some
time on google. The problem is not getting perl to use DLLs, as you
stated that can be easily done, but .Net DLLs are a little trickier.
not just with Perl but with almost any non .Net language. I am fairly
certain from what I read that the Win32-API will not work for want I
want to do. Thanks for the suggestion though.
-SteveM
------------------------------
Date: Fri, 7 Dec 2007 17:15:31 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Doing the Impossible? :: Is there anyway to access custom .Net DLLs from within Perl
Message-Id: <jmbo25-sln.ln1@osiris.mauzo.dyndns.org>
Quoth SteveM <steve.moody@philips.com>:
> On Dec 7, 8:39 am, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
> wrote:
> > SteveM wrote:
> > > I am thinking from my research that this is probably one of those
> > > things that just can not be done,
> >
> > Hu.. maybe I don't understand, but searching for "perl 'accessing dll'"
> > on my favorite Internet search engine showed many links about how
> > to do this. One of them showed using Win32::API:
>
> Actually I saw these posts, and believe it or not I did spend some
> time on google. The problem is not getting perl to use DLLs, as you
> stated that can be easily done, but .Net DLLs are a little trickier.
> not just with Perl but with almost any non .Net language. I am fairly
> certain from what I read that the Win32-API will not work for want I
> want to do. Thanks for the suggestion though.
Note that this is exactly the same as calling a .Net assembly from C,
C++, or any other unmanaged language, so you would have had more luck
searching for that. IIUC the easiest way is to wrap your assembly in a
COM component, and call that using Win32::OLE. See e.g.
http://msdn2.microsoft.com/en-us/library/zsfww439(VS.71).aspx .
Alternatively you could put some effort into writing an Inline::CSharp
module, that knows how to load and start the CLR and then load the
assembly, though I expect that would be quite a lot of work.
Ben
------------------------------
Date: Fri, 7 Dec 2007 09:50:07 -0800 (PST)
From: SteveM <steve.moody@philips.com>
Subject: Re: Doing the Impossible? :: Is there anyway to access custom .Net DLLs from within Perl
Message-Id: <68b52cb3-a12e-481f-9fc9-c1417e030d16@a35g2000prf.googlegroups.com>
On Dec 7, 9:15 am, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth SteveM <steve.mo...@philips.com>:
>
>
>
>
>
> > On Dec 7, 8:39 am, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
> > wrote:
> > > SteveM wrote:
> > > > I am thinking from my research that this is probably one of those
> > > > things that just can not be done,
>
> > > Hu.. maybe I don't understand, but searching for "perl 'accessing dll'"
> > > on my favorite Internet search engine showed many links about how
> > > to do this. One of them showed using Win32::API:
>
> > Actually I saw these posts, and believe it or not I did spend some
> > time on google. The problem is not getting perl to use DLLs, as you
> > stated that can be easily done, but .Net DLLs are a little trickier.
> > not just with Perl but with almost any non .Net language. I am fairly
> > certain from what I read that the Win32-API will not work for want I
> > want to do. Thanks for the suggestion though.
>
> Note that this is exactly the same as calling a .Net assembly from C,
> C++, or any other unmanaged language, so you would have had more luck
> searching for that. IIUC the easiest way is to wrap your assembly in a
> COM component, and call that using Win32::OLE. See e.g.http://msdn2.microsoft.com/en-us/library/zsfww439(VS.71).aspx.
>
> Alternatively you could put some effort into writing an Inline::CSharp
> module, that knows how to load and start the CLR and then load the
> assembly, though I expect that would be quite a lot of work.
>
> Ben- Hide quoted text -
>
> - Show quoted text -
Thanks to all who have responded... the COM angle looks intriguing, I
will investigate that more. This is exactly what I was looking for,
and may prove out to be the answer. Thanks again for your responses
-SteveM
------------------------------
Date: Fri, 7 Dec 2007 08:05:13 -0800 (PST)
From: SteveM <steve.moody@philips.com>
Subject: Doing the Impossible? :: Is there anyway to access custom .Net DLLs from within Perl
Message-Id: <5070e36a-cb97-4c61-af34-adfd7fe615d5@w28g2000hsf.googlegroups.com>
I am thinking from my research that this is probably one of those
things that just can not be done, but just in case I have missed
something let me ask. First off I am NOT talking about accessing Perl
from .Net I know there are ways to do that. What I am wanting to do is
to use in a Perl program a custom .Net library I wrote in C#. Actually
the issue goes bigger then that. We have a great deal of time and
effort invested in a rather large Perl based archatecture in custom
tools and environment. We have recently started investing time and
effort in .Net and C# but do not want to lose the work already done in
Perl. In order to do this we need to be able to call (from inside
Perl) C# and .Net custom crafted DLLs. One example is a library I just
finished that when embeded in a C# program will track the tool's usage
(information about the user, machine, application, etc). This library
works great for C# programs but we would like to use it in the Perl
applications we have as well. Nothing I found as of yet would indicate
that this is possible... does any one have any ideas or know of a way
to do this.
Thanks
-SteveM
------------------------------
Date: Fri, 07 Dec 2007 10:39:05 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Doing the Impossible? :: Is there anyway to access custom .Net DLLs from within Perl
Message-Id: <4759772a$0$512$815e3792@news.qwest.net>
SteveM wrote:
> I am thinking from my research that this is probably one of those
> things that just can not be done,
Hu.. maybe I don't understand, but searching for "perl 'accessing dll'"
on my favorite Internet search engine showed many links about how
to do this. One of them showed using Win32::API:
http://search.cpan.org/~cosimo/Win32-API-0.47/API.pm
"With this module you can import and call arbitrary functions from
Win32's Dynamic Link Libraries (DLL), without having to write an XS
extension. Note, however, that this module can't do anything (parameters
input and output is limited to simpler cases), and anyway a regular XS
extension is always safer and faster."
Otherwise, you should be able to access it via an XS extension.
------------------------------
Date: Fri, 07 Dec 2007 11:09:39 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Doing the Impossible? :: Is there anyway to access custom .Net DLLs from within Perl
Message-Id: <47597e53$0$504$815e3792@news.qwest.net>
SteveM wrote:
> On Dec 7, 8:39 am, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
> wrote:
>> SteveM wrote:
>>> I am thinking from my research that this is probably one of those
>>> things that just can not be done,
>> Hu.. maybe I don't understand, but searching for "perl 'accessing dll'"
>> on my favorite Internet search engine showed many links about how
>> to do this. One of them showed using Win32::API:
>>
>> http://search.cpan.org/~cosimo/Win32-API-0.47/API.pm
>>
>> "With this module you can import and call arbitrary functions from
>> Win32's Dynamic Link Libraries (DLL), without having to write an XS
>> extension. Note, however, that this module can't do anything (parameters
>> input and output is limited to simpler cases), and anyway a regular XS
>> extension is always safer and faster."
>>
>> Otherwise, you should be able to access it via an XS extension.
>
> Actually I saw these posts, and believe it or not I did spend some
> time on google. The problem is not getting perl to use DLLs, as you
> stated that can be easily done, but .Net DLLs are a little trickier.
> not just with Perl but with almost any non .Net language. I am fairly
> certain from what I read that the Win32-API will not work for want I
> want to do. Thanks for the suggestion though.
> -SteveM
Hmmm... OK.. how about this:
http://www.perlmonks.org/?node_id=392275
------------------------------
Date: Fri, 7 Dec 2007 08:28:23 -0800 (PST)
From: cyrusgreats@gmail.com
Subject: Re: How to parse out specific data in text files and plugs into the spreadsheet
Message-Id: <67e19654-b1bd-4d03-8d4b-8b08c41ae403@d27g2000prf.googlegroups.com>
On Dec 6, 5:38 pm, Tad McClellan <ta...@seesig.invalid> wrote:
> cyrusgre...@gmail.com <cyrusgre...@gmail.com> wrote:
> > I need help writing a script in perl that takes text files and parses
> > out specific
>
> You have left the specifics unspecified...
>
> > data and plugs the data back into the spreadsheet.
>
> Errr, what flavor of spreadsheet would that be?
>
> Many of them have there own, uncompatible, data formats.
>
> > Can
> > anyone help me on that..
>
> Yes.
>
> > Thanks in advance..
>
> You're welcome in advance.
>
> --
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
Well what meant by specifics, each person in this exmaple have an id
as follows:
Capitan id : 123456
Time arrival : 10:00:56
Time left : 12:11:23
Capitan id : 88456
Time arrival : 1100:56
Time left : 12:17:0
As for spreadsheet, excel file would work!
------------------------------
Date: Fri, 7 Dec 2007 09:18:35 -0800 (PST)
From: cyrusgreats@gmail.com
Subject: Re: How to parse out specific data in text files and plugs into the spreadsheet
Message-Id: <972364fd-a907-41b7-b233-ec51e75177dd@s19g2000prg.googlegroups.com>
On Dec 7, 8:42 am, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
wrote:
> cyrusgre...@gmail.com wrote:
> >>> I need help writing a script in perl that takes text files and parses
> >>> out specific
> [...]
> > Well what meant by specifics, each person in this exmaple have an id
> > as follows:
>
> > Capitan id : 123456
> > Time arrival : 10:00:56
> > Time left : 12:11:23
>
> > Capitan id : 88456
> > Time arrival : 1100:56
> > Time left : 12:17:0
>
> > As for spreadsheet, excel file would work!
>
> You will need to put SOME work into this. You'll have to
> parse it into the various fields and you could use
> Spreadsheet::WriteExcel to create an Excel file.
>
> http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.20/lib/Spr...- Hide quoted text -
>
> - Show quoted text
I've already wrote the code for Spreadsheet what is left parsing the
data and put them possibly into the has with their value.
------------------------------
Date: Fri, 7 Dec 2007 17:49:34 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: How to parse out specific data in text files and plugs into the spreadsheet
Message-Id: <emdo25-0vn.ln1@osiris.mauzo.dyndns.org>
[please don't quote Google's -hide quoted text- rubbish]
Quoth cyrusgreats@gmail.com:
> On Dec 7, 8:42 am, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
> wrote:
> > cyrusgre...@gmail.com wrote:
> > >>> I need help writing a script in perl that takes text files and parses
> > >>> out specific
> > [...]
> > > Well what meant by specifics, each person in this exmaple have an id
> > > as follows:
> >
> > > Capitan id : 123456
> > > Time arrival : 10:00:56
> > > Time left : 12:11:23
> >
> > > Capitan id : 88456
> > > Time arrival : 1100:56
> > > Time left : 12:17:0
> >
> > > As for spreadsheet, excel file would work!
> >
> > You will need to put SOME work into this. You'll have to
> > parse it into the various fields and you could use
> > Spreadsheet::WriteExcel to create an Excel file.
> >
> >
> http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.20/lib/Spr...-
>
> I've already wrote the code for Spreadsheet what is left parsing the
> data and put them possibly into the has with their value.
You mean like
my @records;
{
open my $FILE, '<', 'file.txt'
or die "can't open file.txt: $!";
local $/ = '';
while (my $rec = <$FILE>) {
my @fields = split /\n/, $rec;
my %rec;
for (@fields) {
my ($k, $v) = /([^:]*) \s* : \s* (.*)/x
or die "invalid field: '$_'";
$rec{$k} = $v;
}
push @records, \%rec;
}
}
? Was that really so difficult?
Ben
------------------------------
Date: Fri, 7 Dec 2007 12:52:56 -0800 (PST)
From: cyrusgreats@gmail.com
Subject: Re: How to parse out specific data in text files and plugs into the spreadsheet
Message-Id: <5b2ab678-979c-4046-b9eb-00bc008bb748@s19g2000prg.googlegroups.com>
On Dec 7, 9:49 am, Ben Morrow <b...@morrow.me.uk> wrote:
> [please don't quote Google's -hide quoted text- rubbish]
>
> Quoth cyrusgre...@gmail.com:
>
>
>
>
>
> > On Dec 7, 8:42 am, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
> > wrote:
> > > cyrusgre...@gmail.com wrote:
> > > >>> I need help writing a script in perl that takes text files and parses
> > > >>> out specific
> > > [...]
> > > > Well what meant by specifics, each person in this exmaple have an id
> > > > as follows:
>
> > > > Capitan id : 123456
> > > > Time arrival : 10:00:56
> > > > Time left : 12:11:23
>
> > > > Capitan id : 88456
> > > > Time arrival : 1100:56
> > > > Time left : 12:17:0
>
> > > > As for spreadsheet, excel file would work!
>
> > > You will need to put SOME work into this. You'll have to
> > > parse it into the various fields and you could use
> > > Spreadsheet::WriteExcel to create an Excel file.
>
> >http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.20/lib/Spr...
>
> > I've already wrote the code for Spreadsheet what is left parsing the
> > data and put them possibly into the has with their value.
>
> You mean like
>
> my @records;
>
> {
> open my $FILE, '<', 'file.txt'
> or die "can't open file.txt: $!";
>
> local $/ = '';
>
> while (my $rec = <$FILE>) {
> my @fields = split /\n/, $rec;
> my %rec;
>
> for (@fields) {
> my ($k, $v) = /([^:]*) \s* : \s* (.*)/x
> or die "invalid field: '$_'";
> $rec{$k} = $v;
> }
>
> push @records, \%rec;
> }
> }
>
> ? Was that really so difficult?
>
> Ben- Hide quoted text -
>
> - Show quoted text -
Thanks but I'm getting error: invalid field in this line:
my ($k, $v) = /([^:]*) \s* : \s* (.*)/x
or die "invalid field: '$_'";
------------------------------
Date: Fri, 07 Dec 2007 10:42:53 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: How to parse out specific data in text files and plugs into the spreadsheet
Message-Id: <4759780d$0$512$815e3792@news.qwest.net>
cyrusgreats@gmail.com wrote:
>>> I need help writing a script in perl that takes text files and parses
>>> out specific
[...]
> Well what meant by specifics, each person in this exmaple have an id
> as follows:
>
> Capitan id : 123456
> Time arrival : 10:00:56
> Time left : 12:11:23
>
> Capitan id : 88456
> Time arrival : 1100:56
> Time left : 12:17:0
>
> As for spreadsheet, excel file would work!
You will need to put SOME work into this. You'll have to
parse it into the various fields and you could use
Spreadsheet::WriteExcel to create an Excel file.
http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.20/lib/Spreadsheet/WriteExcel.pm
------------------------------
Date: Fri, 07 Dec 2007 11:47:21 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: How to parse out specific data in text files and plugs into the spreadsheet
Message-Id: <4759872a$0$3567$815e3792@news.qwest.net>
cyrusgreats@gmail.com wrote:
> On Dec 7, 8:42 am, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
> wrote:
>> cyrusgre...@gmail.com wrote:
>>>>> I need help writing a script in perl that takes text files and parses
>>>>> out specific
>> [...]
>>> Well what meant by specifics, each person in this exmaple have an id
>>> as follows:
>>> Capitan id : 123456
>>> Time arrival : 10:00:56
>>> Time left : 12:11:23
>>> Capitan id : 88456
>>> Time arrival : 1100:56
>>> Time left : 12:17:0
>>> As for spreadsheet, excel file would work!
>> You will need to put SOME work into this. You'll have to
>> parse it into the various fields and you could use
>> Spreadsheet::WriteExcel to create an Excel file.
>>
>> http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.20/lib/Spr...
> I've already wrote the code for Spreadsheet what is left parsing the
> data and put them possibly into the has with their value.
You could use split or a regular expression.
perldoc -f split
perldoc perlretut
Why not give it a try, post it, and explain what steps are
causing problems. You're not paying us enough to write your
code for you. :-)
------------------------------
Date: Fri, 7 Dec 2007 11:44:57 -0800 (PST)
From: doni <doni.sekar@gmail.com>
Subject: passing arguments to a shell script from a perl script
Message-Id: <334d83c5-05e8-46e8-ac36-59645f2b05b1@s19g2000prg.googlegroups.com>
Hi,
Is there anyway can I pass arguments to a shell (bash) script from
within a perl script and execute the shell script.
The reason I want to call a shell script is that I want to export
environmental variables. Since, we can't do it from a perl script, I
wanted to write the environmental variables in a shell script and
execute it.
Can anyone let me know how can I do this in perl.
Thanks,
doni
------------------------------
Date: Fri, 07 Dec 2007 14:05:26 -0600
From: aaah <StaminaJ@nowhere.com>
Subject: Re: passing arguments to a shell script from a perl script
Message-Id: <t4qdnbO_4csbOsTaRVnyvgA@giganews.com>
Hi
You can actually actually indeed do this from within a perl script.
You can also set environment variables from within perl. I'm sure
you will get a few responses on this one as there are various ways,
the simplest way would be to do:
______________
my $script_to_execute = "script_name" ;
my $parameters = "one two three" ;
my $shell_call = $script_to_execute . " $parameters" # note the
space
system($shell_call)
______________
Hope the above helps.
cheers
--
--------------------------------- --- -- -
Posted with NewsLeecher v3.9 Beta 6
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -
------------------------------
Date: Fri, 7 Dec 2007 12:44:19 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: passing arguments to a shell script from a perl script
Message-Id: <c40d657e-b869-402b-94e5-b1ea8b29bb48@w56g2000hsf.googlegroups.com>
On Dec 7, 2:44 pm, doni <doni.se...@gmail.com> wrote:
> Hi,
>
> Is there anyway can I pass arguments to a shell (bash) script from
> within a perl script and execute the shell script.
>
> The reason I want to call a shell script is that I want to export
> environmental variables. Since, we can't do it from a perl script, I
> wanted to write the environmental variables in a shell script and
> execute it.
>
> Can anyone let me know how can I do this in perl.
>
> Thanks,
> doni
Code called by system inherits the perl environment.
Try this:
perl -e '$ENV{PATH} .= ":/new/path"; system "echo \$PATH";'
------------------------------
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 1097
***************************************