Hi ,
I would like to sort an array like this
my @pets = {$cat, $dog,$camel,$camel,$camel,$dog}
and then to have it printed out in the order of occurrences
print "I will give you <3> camels, <2> dogs, <1> cat " for the blond one
Tnx Kenan
> > Question: What is "flush"? and how can a filehandle be flushed? I saw
> > such a phrase while looking for info about file locking.
>
> If you would rather have every byte sent down that pipeline without
> buffering, you can set a filehandle as unbuffered with the following:
>
> my prev = s
I have written a form to email parser and have it working fine, the
response page is a formatted html table which looks quite nice. I want
to have the same table emailed to a person in my company, but the
mail shows the html code, not the formatted table. I found out the
problem is the message
On Thu, 17 May 2001, Davidhayesmoats wrote:
> I have a perl script running and i keep getting this error message:
> Use of uninitialized value in string eq at
>I:\Inetpub\wwwroot\PL1\cgi-bin\members_admin.pl line 66.
>
> The code from that area is:
>
> # decide task according to mode
>
> if ($mo
I have a perl script running and i keep getting this error message:
Use of uninitialized value in string eq at
I:\Inetpub\wwwroot\PL1\cgi-bin\members_admin.pl line 66.
The code from that area is:
# decide task according to mode
if ($mode eq "menu") < line 66
{
# Menu mode - Output
Joel R Stout writes ..
>I want to get the file names of all "EDI" files from a certain
>directory. I
>do not want "ENT" (or encrypted) file names.
>
>Example:
>
>The directory contains:
>a001.edi
>a002.edi
>a003.edi.ent
>a004.EDI
>
>After getting the file name in $_ I did the following match
You may want to check this out:
http://search.cpan.org/doc/BTROTT/Net-SSH-Perl-1.13/lib/Net/SSH/Perl.pm
I bet this will get you where you want to go.
~Matt C.
--- Ken Hammer <[EMAIL PROTECTED]> wrote:
>
> I need to write a perl script that will gather system information
> from remote machine
How do u install the DBD::Informix module...after i install it using
MCPAN...theres always an error saying sth like wont make , wont
install.
DBI seems to be installed corrrectly,
but when i write a simple program with just connecting to a database,
it says that DBI::Informix may not be installed
/edi$/i I think?
On 05/17, John Joseph Trammell rearranged the electrons to read:
> On Thu, May 17, 2001 at 09:25:53PM -, Stout, Joel R wrote:
> > if (/edi\b/i) { # thinking I would match file names 1, 2, and 4. Instead I
> > matched on all. Wasn't \b supposed to help me out here? Or does
On Thu, May 17, 2001 at 09:25:53PM -, Stout, Joel R wrote:
>
> I want to get the file names of all "EDI" files from a certain directory. I
> do not want "ENT" (or encrypted) file names.
>
> Example:
>
> The directory contains:
> a001.edi
> a002.edi
> a003.edi.ent
> a004.EDI
>
> After ge
I want to get the file names of all "EDI" files from a certain directory. I
do not want "ENT" (or encrypted) file names.
Example:
The directory contains:
a001.edi
a002.edi
a003.edi.ent
a004.EDI
After getting the file name in $_ I did the following match:
if (/edi\b/i) { # thinking I would
I haven't worked with the OLE modules at all but I'll put in my 2 cents.
It's not clear to me that $filename is open from this snippet. It looks
like $filename gets defined and then you delete it if it's there and is a
regular file. I don't know what the SaveAs method does but I'm guessing it
sa
>is it possible to read in this file and what ever is before the : would
>become the name of
>the array?
>
>IE:
>I add this to the config file
>full:apple grape chestnut
What you're describing sounds like a symbolic reference which would give you
something like...
($arrayName, $stuff) = (split
- Original Message -
From: David H. Adler <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 17, 2001 7:13 PM
Subject: Re: Arrays of hashes?
(...)
> Technically, that's not *literally* possible. But you can have an array
> of *references* to hashes (as assoc. arrays tend
> How can I find out if an array contains a particular element stored in a
> certain variable ?
>
> eg variable TEST1 = "030"
>
> array HOLDER = "020 040 034 056 030"
>
> I need to find out if "030" is present in the array HOLDER
You can do it a couple of ways (there's ALWAYS more than one way to
Better point would be use hash % then you could use the number as a key into
the array like
if ( defined $Holder{$TEST1} ) {
# found, so do something
}else {
# not found do something
}
so you could do:
my %HOLDER = ('020', 1, '040', 1, '034', 1, '056', 1, '030', 1);
if ( defined
--- a p <[EMAIL PROTECTED]> wrote:
> Hi,
Hi. =o)
> Today is my first day on Perl so please bear with me if this sounds
> stupid...
lol -- welcome aboard, and don't worry about it.
Just be sure to do this:
perldoc -t perl >tmp
and then look at tmp to see the things you can look at in more
Perl has a foreach loop that is very apt at doing what you want.
i.e.
#!/usr/local/bin/perl5
$test1 = "030";
@holder = qw(020 040 034 056 030);
foreach (@holder) {
$test = true if ($_ == $test1);
}
This loop cycles through each element of the array, temporarily housing it
in the special
--- "David H. Adler" <[EMAIL PROTECTED]> wrote:
> On Thu, May 17, 2001 at 12:08:56PM -0500, John Storms wrote:
> > Is it possible to have an array of associative arrays?
>
> Technically, that's not *literally* possible. But you can have an
> array of *references* to hashes (as assoc. arrays ten
Hi,
Today is my first day on Perl so please bear with me if this sounds
stupid...
How can I find out if an array contains a particular element stored in a
certain variable ?
eg variable TEST1 = "030"
array HOLDER = "020 040 034 056 030"
I need to find out if "030" is present in the array HO
Hi,
I tried a lttle bit to get used to Win32::OLE
And also searched tutorials on the Web. I found an interesting one, but
at this part in the code I get stuck...
--- CODE
//some sutff
$filename = 'd:\apache\apache\cgi-bin\perl2.xls';
unlink $filename if -f $filename;
$workbook->Sav
On May 17, Yacketta,Ronald J said:
>backint:maple aspen pine
>online:orange palm cherry
>
>is it possible to read in this file and what ever is before the : would
>become the name of
>the array?
The key is, DON'T DO THAT. Don't make arrays with names you don't know
ahead of time. It's best to
Peter,
Is it possible to-do this?
in the config file I have (as you have seen b4)
backint:maple aspen pine
online:orange palm cherry
is it possible to read in this file and what ever is before the : would
become the name of
the array?
IE:
I add this to the config file
full:apple grape chestn
Hi. This is my first posting to this list. I hope someone can lend me a
hand with some info.
I would like to be able to directly interact with A 4D database using
Perl's DBI module. Have any of you done this successfully?
It is not clear to me which database driver I need. I suspect it is
DBD::O
On May 17, [EMAIL PROTECTED] said:
> $
> Contains the subpattern from the corresponding set
> of parentheses in the last pattern matched, not
> counting patterns matched in nested blocks that have
> been exited already. (Mnemonic: like \digits.
Sure, just try running these 2 bits of code and you'll see what that means:
### example 1 ###
$foo = 'bar';
$foo =~ /(bar)/;
$firstmatch = $1;
$foo =~ /(quux/;
$secondmatch = $1;
print "$firstmatch and $secondmatch\n";
### example 2 ###
$foo = 'bar';
{
$foo =~ /(bar)/;
$firstmatc
On Thu, 17 May 2001, John Storms wrote:
> Is it possible to have an array of associative arrays?
Sure. Just stick hashrefs into each array element:
my @array = (
{ name => 'Jim', location => 'Buffalo' },
{ name => 'Bill', location => 'Boston' }
);
T
> I am still very much the newbie, but to my untrained mind,
> this completely blows away getopts.
Getopt is a lot more flexible than the -s switch. I agree that -s is
fine for basic stuff, but for more complicated command-line parsing (like
switch bundling, or forcing a mandatory datatype), you
On Thu, May 17, 2001 at 12:08:56PM -0500, John Storms wrote:
> Is it possible to have an array of associative arrays?
Technically, that's not *literally* possible. But you can have an array
of *references* to hashes (as assoc. arrays tend to be called nowadays).
You should take a look at
perl
: the above works fine and dandy (I think)
: but when I replace the print in the for() with a system call as such
: system "mminfo -a -r \"volume,mediarec,ssid,name\" -q \"location=sun_etl\"
: -V -o tR -c $_ >> out";
: I get a broken pipe and the output from the mminfo command is spewed on the
:
just an offhand guess but when I've run into this it's been an unsuspected
new line. Try adding a chomp $line to the top of the while loop.
Peter C.
Hello all!!
here is my little problem, I have a file that I must parse and then once
parsed I need to run a legato networker mminfo command to generate a list of
save set id's to use for a cloning process.
the config file looks like such
backint:maple oak pine aspen
online:palm chestnut cherry
a
Gurus,
perldoc perlvar says:
$
Contains the subpattern from the corresponding set
of parentheses in the last pattern matched, not
counting patterns matched in nested blocks that have
been exited already. (Mnemonic: like \digits.)
Is it possible to have an array of associative arrays?
---
[EMAIL PROTECTED] (Galactic Hero)
Diplomacy: The art of saying good doggie
while searching for a big rock.
On Thu, May 17, 2001 at 10:12:45AM +1000, King, Jason wrote:
>
> I just wanted to clarify that most Windows programs don't need the shebang
> line at all .. windows works off filename extensions - not shebang lines
>
> so it's only really important under Apache in Windows which still requires a
On May 17, Peter Cornelius said:
>$returnCode eq "o.k." ? $subject .= " -OK-" : $subject .= " -FAILED-";
You're being bitten by precedence. ?: is stronger than .=, so your code
is like:
($foo == 1 ? $bar .= "this" : $bar) .= "that";
Which means that if $foo is 1, $bar gets "thisthat" tacked
I don't know if this will help at all, but I just found out, myself,
about the -s option.
If you run your script with:
#!/usr/bin/perl -s
and remember, to keep strict happy, to:
use vars qw($all_the $variables $you_need $from_stdin);
You can run your script like this:
bash-2.03$ script.pl -varia
I use the tertiary conditional all the time but I just got some inexplicable
behavior and wanted to see what the group had to say. I have a bit of
code...
my $subject = "Status";
my $returnCode = "o.k.";
print "$subject\n";
$returnCode eq "o.k." ? $subject .= " -OK-" : $subject .= " -FAILED-";
On Thu, 17 May 2001, Craig Moynes/Markham/IBM wrote:
> I tried using the getopts, and getopt but I can't seem to have mandatory
> parameters with optional parameters.
> I have something like this for my usage
> perl scp_logs.pl -u username -h hostname -l local_directory [-r
> remote_directory]
S
--- Craig Moynes/Markham/IBM <[EMAIL PROTECTED]> wrote:
> I tried using the getopts, and getopt but I can't seem to have
> mandatory parameters with optional parameters.
> I have something like this for my usage
> perl scp_logs.pl -u username -h hostname -l local_directory [-r
> remote_directory]
I tried using the getopts, and getopt but I can't seem to have mandatory
parameters with optional parameters.
I have something like this for my usage
perl scp_logs.pl -u username -h hostname -l local_directory [-r
remote_directory]
Any thoughts on ways to manually parse the parameteres from @ARG
well, actually you cant *just* use || instead of or, seeing || binds
tighter...
just try running this bit of code, and you'll see what i mean:
if($c || $d = 2) { print "foo" }
thus, if you use || and you wish to compare like you do, you *have* to use
parens
correct code would therefor be
if($a
--- Doug Johnson <[EMAIL PROTECTED]> wrote:
> Is there a better way to write:
> my $x = "return";
> if (($x = "a")
> || ($x = "test" )
> || ($x = "return" )
> || ($x = "x-retun"))
>{
>print("bunch of foo);
>}
Several =o) [and my apologies for the reformat, but I needed to fit i
--- kosta <[EMAIL PROTECTED]> wrote:
> Question: What is "flush"? and how can a filehandle be flushed? I saw
> such a phrase while looking for info about file locking.
Most filehandles are buffered by default, which means they don't bother
doing IO to the disk/socket/whatever until they have a b
--- jane doe <[EMAIL PROTECTED]> wrote:
> How do I remove duplicate items from an array? I apologize for being
> a "newbie". :)
my @a = (1,2,2,3,4,4,5);
my %h;
@h{@a} = (); # hash keys are unique
@a = sort keys %k;
The line
@h{@a} =();
is a bulk assignment of all elements of @a as keys in hash
At 11:34 AM 5/17/2001 +0100, Alberto Manuel Brandao Simoes wrote:
>On Thu, May 17, 2001 at 11:23:00AM +0200, Jos Boumans wrote:
>( Alberto,
>(
>( let's start with something very basic:
>( DO NOT use variables as variable names!
>(
> Let's see if I can explain what I'm doing. I'm writing a
At 09:03 AM 5/17/2001 +0100, Alberto Manuel Brandao Simoes wrote:
> Hellows
>
> I'm writing a module and, as all modules should be, I'm using
> strict. So, I
>need to 'declare' every variable. What I want, is to do something like:
>
> $varname = "myvar";
> @$varna
Yea there are a lot of values and if I go back and look at my code I do have
eq instead of the =. I still had the multiple parens though. I was thinking
that the comparison may hold true when it crosses the "or" statement without
the parenthesis. I will give the hash a try and let you know if I h
On May 17, Doug Johnson said:
>my $x = "return";
>
>if (($x = "a") || ($x = "test" ) || ($x = "return" ) || ($x = "x-retun"))
> {
> print("bunch of foo);
> }
First, that's NOT the code you have. If it IS, it's broken.
if ($x eq 'a' or $x eq 'test' or $x eq 'return' or $x eq 'x-retu
On May 17, Paul Johnson said:
>You can't. You are trying to use symbolic references and when you have
>strict turned on you are promising not to do that.
>my $varname = "myvar";
>{
>no strict "refs";
>no strict "vars";
>@$varname = ('a','b','c');
>}
It's important to know one thing
I received this warning for a script I was using when we switched from Sun 4.1
to Solaris:
perl: warning: Set locale (LC_CTYPE, "") failed.
perl: warning: LC_ALL = "(null)", LC_CTYPE = "en_US", LANG = "en_US"
perl: warning: Falling back to the "C" locale.
The LC_CTYPE is causing the problem, but
Normally all filehandles (except STDERR, I think) are buffered.
That means that if you write a character (or a byte) on a filehandle,
the system does not write it on the disk immediatly, but waits till it's
buffer is full and than writes the whole buffer. This saves many
IO-Operations,
which resul
Is there a better way to write:
my $x = "return";
if (($x = "a") || ($x = "test" ) || ($x = "return" ) || ($x = "x-retun"))
{
print("bunch of foo);
}
Could my if comparison be made smaller? I would like to compare 1 value to
a list without multiple "x =".
Best Regards,
Doug
On Thu, 17 May 2001, kosta wrote:
> Question: What is "flush"? and how can a filehandle be flushed? I saw
> such a phrase while looking for info about file locking.
Found in /usr/lib/perl5/5.6.1/pods/perlfaq5.pod
How do I flush/unbuffer an output filehandle? Why must I
do this?
Francis, how new are you to Perl. Im extremely new!
--- Francis Henry <[EMAIL PROTECTED]>
wrote:
> me!
>
> RS wrote:
>
> > Kind of off topic but, is anyone in this list
> located
> > in NYC?
> >
> > =
> > **R.S.** (pronounced R-dot S-dot)
> > "Look at all the pretty C shells"
> >
> > _
: Kind of off topic but, is anyone in this list located
: in NYC?
Let's try to send responses to this directly to RS, and not to the list.
Thanx, my inbox appreciates it! :-)
Stephen Neu
Internet Development
Characterlink.net
(630) 323-9800 ext. 235
me!
RS wrote:
> Kind of off topic but, is anyone in this list located
> in NYC?
>
> =
> **R.S.** (pronounced R-dot S-dot)
> "Look at all the pretty C shells"
>
> __
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
>
Kind of off topic but, is anyone in this list located
in NYC?
=
**R.S.** (pronounced R-dot S-dot)
"Look at all the pretty C shells"
__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
hi!
Question: What is "flush"? and how can a filehandle be flushed? I saw such a phrase
while looking for info about file locking.
thanks in advance,
kosta
On May 17, Alberto Manuel Brandao Simoes said:
>RULE ---> FILE*
>
>::t {
> for (@FILE) {
> #do something
> }
>}
>
>The idea is, when parsing the RULE, create the FILE array so that the user can
>browse it. This is done by an eval, so I can construct a string initializing
On Thu, 17 May 2001, Joel Divekar wrote:
> Please I am looking for tutorials and mailing list on cryptography and also
> on Hacking (to make our site secure)
You mean, Cracking don't you? Hacking and cracking are different things.
Take a look at the O'Reilly book _Practical Unix & Internet Sec
Hi
Please I am looking for tutorials and mailing list on cryptography and also
on Hacking (to make our site secure)
Regards
Joel
--
QuantumLink Communications, Bombay, India
-Original Message-
From: Porter, Chris
Sent: Thursday, May 17, 2001 6:59 AM
To: '[EMAIL PROTECTED]'
Subject: RE: FW: delete files
Thanks, helps very much. The directory -- I added the directory I'm
referring to.
opendir DIR - added the same directory()
Can u break this code do
On Thu, May 17, 2001 at 11:23:00AM +0200, Jos Boumans wrote:
( Alberto,
(
( let's start with something very basic:
( DO NOT use variables as variable names!
(
Let's see if I can explain what I'm doing. I'm writing a 'compiler',
well... interpreter for a grammar style language. There woul
On Thu, May 17, 2001 at 09:03:33AM +0100, Alberto Manuel Brandao Simoes wrote:
>
> Hellows
>
> I'm writing a module and, as all modules should be, I'm using strict.
I trust you've got warnings turned on too.
> So, I need to 'declare' every variable. What I want, is to do
>
On Thu, May 17, 2001 at 12:52:45PM +0530, Joel Divekar wrote:
> Please I am looking for tutorials and mailing list on cryptography and also
> on Hacking (to make our site secure)
http://lists.perl.org/showlist.cgi?name=perl-crypto
http://www.tuxedo.org/~esr/faqs/hacker-howto.html
Oh! You mea
Alberto,
let's start with something very basic:
DO NOT use variables as variable names!
seeing MJD already wrote a very nice piece about why that's a bad idea, i'll just refer
you to his site:
http://perl.plover.com/varvarname.html
Now, what *should* you do?
1. if you want multiple values for
Thanks for that explanation Jason, I'm always happier when I know *why*
something doesn't work.
What I've ended up doing, and was also suggested in another branch of
this thread was to pass a reference to the whole array, and a start and
end index number. This appears to provide the fastest r
Hi
Please I am looking for tutorials and mailing list on cryptography and also
on Hacking (to make our site secure)
Regards
Joel
--
QuantumLink Communications, Bombay, India
Hi
Please I am looking for tutorials and mailing list on cryptography and also
on Hacking (to make our site secure)
Regards
Joel
--
QuantumLink Communications, Bombay, India
Hellows
I'm writing a module and, as all modules should be, I'm using strict. So, I
need to 'declare' every variable. What I want, is to do something like:
$varname = "myvar";
@$varname = ('a','b','c');
This sets @myvar as I want, but how can I do this w
Hello,
I need an ODBC driver for the OS HP-UX 10.20 ( Unixplatform )
Where I can download this driver, and what I am doing to install this
driver?
Thanks a lot
Hasan Ügür
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
Does anyone knows how to decode a Mail and attached file in different formats such as
: (Txt, Html, pdf, ecc.).
In case that no one knows how to do it in Perl, there is any program I can use to
decode, or another language that I could integrate in a perl script.
thanks for the help!
Alejand
73 matches
Mail list logo