Should be print TEMP $_;
On Tue, Nov 20, 2001 at 02:57:25PM +0100, Franck Collineau shaped the electrons to
read:
Hi!
I have the follwing code:
#!/usr/bin/perl -w
open(FIC,/home/collineau/Perl/Programmes/01_informatique/sauve/c0111_05.htm)
|| die Impossible d'ouvrir $!\n;
open
Actually what you really need is a hash not an array ...
%employee = ( 'name'='John Doe' , 'age'=32 , 'position'='SE' ,
'start_date'='10/12/2000' );
for my $field (%employee) {
print $field: , $employee{$field} , \n;
}
On Fri, Nov 16, 2001 at 06:00:42AM -0500, Sherri shaped the
howabout
while (FILE) {
next unless /^NC00/;
push @required , $_;
}
On Fri, Nov 16, 2001 at 03:42:59PM -0500, [EMAIL PROTECTED] shaped the
electrons to read:
Hello All,
This appears to be quite simple, but yet the answer has eluded me.
I can/kow how to use a foreach loop
$arrayref seems okay
assuming that $prod is an array ref it should be
$prod-[0] * $prod-[1]
On Fri, Nov 16, 2001 at 11:52:49AM -0500, AMORE,JUAN (HP-Roseville,ex1) shaped the
electrons to read:
Hello,
Do I have the below dereferencing correct.
I a anonymous array and I'm trying to
$rhash-{$key} assuming $key is the value of the key of the hash
so %hash = (key1=val1,key2=val2...etc) would result in $rhash-{key1}
producing val1!!
On Thu, Nov 15, 2001 at 04:08:18PM +, jonathan vandine shaped the electrons to
read:
I am passing a hash as a reference to a subroutine and
Alternatively just read them all in as one big hash inyour sub if you know the
keys are unique to each other ..
On Thu, Nov 15, 2001 at 11:53:47AM -0600, Tomasi, Chuck shaped the electrons to read:
Perl 5.6.0
Sun Solaris 2.7
I'd like to send two or more associative arrays (hashes) to a sub.
Not sure if i am out of line here but shouldnt it be
$out[$ticker] = $_ ;
instead of
$_ = $out[$ticker];
On Fri, Nov 02, 2001 at 11:05:09AM -0500, Wert, Nathaniel shaped the electrons to read:
I am trying to make a feable attempt at parsing a nslookup call. All I actually
want is
There are a couple of very strange things with your questions and code ..
firstly you dont need to put the $_ in the foreach line ... if you dont put
anything there then it will pull the value into $_ on each iteration
secondly your question that $_ was an array is clearly wrong ... $_ can only
something like this
#
# Nothing special .. just opening the file handles
#
open(ONE,one.dat) or die $!,\n;
open(TWO,two.dat) or die $!,\n;
open(THREE,three.dat) or die $!,\n;
#
# sending the file handle into a reference as a glob
# you could also do this $fh =
The first lien makes sure that subsequently $b will not be defined anymore.
THis is necessary whenyou are somehow using the variable $b in subsequent
lines but wanna make sure that there is no previous values to corrupt it.
i have seen it used in a lopp where $b is a global variable for example
my $string = 'pgrap.C4A2S1R.1.gif';
my @s = ($string =~ /(?:\.)*(\w+)(?:\.)*/g);
the arraytores the elements
the //g makes it find more than one match ... post again if you need more
explanation ...
hth
On Tue, Oct 23, 2001 at 06:20:31AM -0500, Jerry Preston shaped the electrons to read:
Hi,
you can also do
perldoc perlvar
On Fri, Oct 19, 2001 at 05:50:48PM +0200, Jos? A. Ferrer shaped the electrons to
read:
Hi,
Where can I find a list of all embedded default perl variables, like $^0,
$_, and so ?
T.I.A.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
i can think of a few ways ...
# loop through the array and check the index
my $index = 1;
for my $value (@array)
{
next if $index%2;
push @only_even , $value;
$index++;
}
# or you can shift two elements and use the last one ...
for my $value (@array) {
# you can
print I stopped at line number ,__LINE__,\n;
On Fri, Sep 07, 2001 at 02:58:30PM +0200, Roland Schoenbaechler shaped the electrons
to read:
In some cases I want to write the line-number of the script to STDERR (In
analogy to the functions die or next). Does a variable exist indicating the
You mentioned in the first part of your email that your script does 1,2,3 and
then in hte second half of your email you said it doesn't do 1,2,3 so i am
going to play it safe and assume you need help retrieving the filenames as
well .. (if i am wrong then just ignore that part)
you might want to
There is a CPAN module Text::CSV_XS that you can use. But your data must be
valid CSV ... ie if there is a comma in the string itself , the entire string
must be in quotes like so
John Doe,1, John Street,DoeVille .
so in your case the proper way to deal with it is to have the input come in
i am writing a module that is a helper module and is part of a larger project
... i am using h2xs and MakeMaker to make the module 'cos i need to distribute
this out to other people who are using the 'larger project' ... i am running
into problems in that the larger project has a place to store
Sorry u r right ... have not really made the mental switch to use 'our' yet
... thanks for pointing it out ..
On Tue, Sep 04, 2001 at 10:35:05AM -0400, Bob Showalter shaped the electrons to read:
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday,
i did not understand the part about working with samll scripts but you could
do somehting like this ... not tested
#!perl
while(1) {
if ( -s $flag_file_location ) {
system($command_to_execute) or warn Cannot execute command\n;
You can always do this
scalar @$ref_arr
but this will give you the number of elements not the last index as $#array
would
On Fri, Aug 31, 2001 at 01:24:53PM -0200, Hamish Whittal shaped the electrons to read:
Hi,
I have a reference to an array $ref_arr
I want the length of the
Your have a typo in the example given below ... you are missing a '$' in front
of members in the main package
for($i=0; $i10; $i++){members-[$i] = $i;}
but should be
for($i=0; $i10; $i++){$members-[$i] = $i;}
if you ran your script with 'use strict' the
Why do you need to go to the website for the source code when you can read it
on your local machine (unless you have not installed those modules ... in
which case I will shut up now)
On Wed, Aug 29, 2001 at 11:13:33AM +0530, Rahul Garg shaped the electrons to read:
Well, I got it myself...
If you need to install the modules and want to know where to get it to install
it then you can always just use CPAN.
isnt LWP and CGI installedd by default for most distributions of perl?
On Wed, Aug 29, 2001 at 11:13:33AM +0530, Rahul Garg shaped the electrons to read:
Well, I got it
Your sort sub is really wierd which makes me suspect that I am
misunderstanding your intentions but if youu want to only sort by the keys
column then the following should work
---code---
%map = { ...blahblahblah... };
for (sort {$a = $b} keys %map ) { printf ...blahblahblah... }
---code---
that
Maybe you can consider something like this ... after reading in from the ORG
file and splitting the elements into @fields ... you can so something along
these lines
for my $field (@fields) {
my $field_length = length($field);
my $format =
The system function runs a command in the OS shell. Whatever is in the params
of system is never Perl code (well maybe it could be if you were using a perl
shell but that is another story) ... the '' is a redirection operator to
redirect the output to a file or handle ..
hope this helps
On
What u are asking for is to have a configuration file. You can easily create
one and then have a subrotuine to parse your configuration file ... ie read
the conf file and determine which is the starting position for the field.
for example read the conf file and have an array that stores the
Hmm i dont get how
/add_\w+/ and print(Yippie!\n), last for keys %hash;
works ... the regexp will be checking $_ right?
On Fri, Aug 24, 2001 at 11:25:18AM -0400, Bob Showalter shaped the electrons to read:
-Original Message-
From: Birgit Kellner [mailto:[EMAIL PROTECTED]]
Thanks ... i figured the logic out the first time round except that I could
not see how the for is called before the regexp is done. But I see it now ...
i was going to suggest a solution using map actually like
print yipe\n if map {/dd_\w+/} keys %hash;
not sure if this would be
I assume you have write privellages for the directory (or else you would not
be able to write the XML doc anyway) .. you can use dbm files ... lookup
DB_File.pm and see the perldocs or check out chapter14 of the perl cookbook.
There are more tools (i might be wrong but it does seem more logical)
You dont really need to use a hash ... just read in the files and then push
them onto an array as u print out the options ... then read in the option
number and that will be the index of the array (remember to take the index
starting from zero into account)
On Wed, Aug 22, 2001 at 11:17:30AM
Herman,
Depending on the context of the string you want to parse there is more than
one way to do it (correction in perl there is always more than one way to do
it TIMTOWTDI) ..
$string = ... your string here ... ;
$string = substr($string,-9,9);
the above solution is assuming you do only want
I must say that I dont agree that Perl is a difficult language for a beginner
.. in fact I think it is easy for a beginner .. as a matter of fact I think it
is TOO easy for a beginner ... and that is why I (my personal opinion only)
dont usually point beginning programmers to Perl as itis too
On Tue, Aug 21, 2001 at 07:10:50AM -0500, Jerry Preston shaped the electrons to read:
Hi!
OK, I am trying to build an return a hash:
$list = 1 2 3 4 5 6 7 8 9 10;
$DAT{ 'heading' } = $list;
I can print it at this time:
print $DAT{ 'heading' }*BR;
or is it better to do it
I go this from some mailing list ... dont know if it helps but for what it is
worth ...
In C, a char is a kind of integer, and so there is such a thing as an unsigned char.
In C, char can mean either unsigned char or signed char,
depending on the platform. (Unlike other kinds of
I have not used Getopt for a long time but I think the answer to your problem
does not exactly lie with Perl ... it is probably more shell related ... if u
put yourself in the shoes of the shell interpreter and look at the commandline
u mentioned below then why would u think that tac and toe were
I dont use CGI.pm a whole lot but looking at the perldocs for CGI.pm it
mentions that upload method takes the name of the upload field. Looking at
the example in the POD it appears that you should be calling upload like this
my $fh = $q-upload( 'file' );
instead of
Can u clarify your question ... what is value1..6 ... it looks like you are
trying to create a hash of references to arrays .. in which case value1 to 6
does not come into play at all
my %hash
$hash{key1}-[\@list1,\@list2,\@list3]
$hash{key2}-[\@list4,\@list3,\@list1]
to dereference the second
$req is already a reference but you called isPresent using the following
syntax
isPresent(\$req,$user) # Wrong
instead of
isPresent($req,$user) # Correct
On Thu, Aug 16, 2001 at 11:32:39AM -0500, David Simcik shaped the electrons to read:
Newbie question here...
I've
Wothout code and the format of the log file I can only suggest this ... others
might have other ideas ..
You could read in the line and try to split on the line to put the list
elements into a hash ... the key of hte hash would be the converted time/date
stamp in epoch then you can loop
I am not sure if this will help but you might be talking about using soft
references ... you would have to turn off strict to use it ...
I could not get my head aroun your description of the problem but I had many
experinces when I had discussions with people at work who felt soft references
Its going to be rather involved in my opinion ... suod will prompt for a
password so you need to use something called Expect to interactively put the
password in ...
one way might be to write a script that prints the output to a webpage and run
that as root ... sorry i know this does not help
I know we should not spend too much bandwidth on something like this .. but I
have been on several lists and this issue always comes up at several points in
the lists history ... I actually think it will be cool for the guys writing
mailing list programs to take the unsubscribing issue into the
I must agree with Jos on this ... I read the email and I saw that what Ron was
asking for was soft reference ... like I mentioned before a lot of the
situations (like I mentioned my experience) .. where you think that soft
reference is the only way to do it is because your mindset had been stuck
Using Benchmark.pm ... the answer is to use lc ... if you flip through to the
Perl Cookbook pg 19 or receipe 1.9 you will find that tr is the wrong way to
do changing of case (or at least tr/A-Z/a-z/ since it will miss accented
characteers and so on..)
THe reason you are getting the error is
45 matches
Mail list logo