Chad Kemp wrote:
> Hello all,
Hello,
>I have a hash anonymous hashes. The data stream that I am getting is
> actually from an SQL query a users ID, like "jones12a3", a subsystem
> name associated to that ID, like "Lotus Notes", and a number, "3" tied
> to the number of subsystems changes tha
For your purpose,using Perl's built-in module File::Basename is a good way.
use File::Basename;
my $filename = basename($topdir);
my $dirname = dirname($topdir);
Good luck!
2007/4/19, Nishi <[EMAIL PROTECTED]>:
Hi:
I am using the following reqular expression to extract the last part ie
$lan
2007/4/19, Chad Kemp <[EMAIL PROTECTED]>:
i can't seem to figure out how to get to it once it is in there...
do i dereference it somehow? they are anonymous hashes, so they have no
name...
Hello,
Once you created the anonymous hash you can put it to a variable.Like,
my $hashref = { 'ke
What do you get?
Try:
my $topdir = "common/default/l_cs";
# Find the part of the string that does not have a slash and is
followed by end of line
$topdir =~ /([^\/]+)$/; # Or should that read /([^/]+)$/ ?
my $lang = $1;
On 4/18/07, Nishi <[EMAIL PROTECTED]> wrote:
Hi:
I am using the followi
Hi:
I am using the following reqular expression to extract the last part ie
$lang of the following string
$topdir = "common/default/l_cs";
my $lang=$topdir =~ /.*\/(.+)$/;
But it doesnt seem to work, what am i missing here?
Thanks!
Hello all,
I have a hash anonymous hashes. The data stream that I am getting
is actually from an SQL query a users ID, like "jones12a3", a subsystem
name associated to that ID, like "Lotus Notes", and a number, "3" tied
to the number of subsystems changes that that user has implemented. s
On 4/18/07, Nishi <[EMAIL PROTECTED]> wrote:
I have a string of the form
$ARGV[0]="abc/def/ghi";
I need to strip abc to convert $ARGV[0] to
$ARGV[0]="def/ghi"
Please let me know how I can achieve it.
Maybe you want one of these?
$ARGV[0] = "def/ghi" if $ARGV[0] eq "abc/def/ghi";
$ARGV
There are lots of ways you could accomplish this, my choice would be
something like
$ARGV[0] =~ s#^[^/]+/##;
-Jason
On 4/18/07, Nishi <[EMAIL PROTECTED]> wrote:
Hi:
I have a string of the form
$ARGV[0]="abc/def/ghi";
I need to strip abc to convert $ARGV[0] to
$ARGV[0]="def/ghi"
Please let m
Hi:
I have a string of the form
$ARGV[0]="abc/def/ghi";
I need to strip abc to convert $ARGV[0] to
$ARGV[0]="def/ghi"
Please let me know how I can achieve it.
Thanks!
I got it. using File::Copy
Thanks!
On 4/18/07, Nishi <[EMAIL PROTECTED]> wrote:
Hi:
My perl program run creates a data file everytime its run is scheduled. I
need to backup the data file everytime i run it so i have a copy of the
original data file. How can i create a copy of this file in m
Hi:
My perl program run creates a data file everytime its run is scheduled. I
need to backup the data file everytime i run it so i have a copy of the
original data file. How can i create a copy of this file in my perl program
before it gets updated. I am taking this file as user input from the co
On 4/18/07, Katie L. Barbee <[EMAIL PROTECTED]> wrote:
I believe this is a very simple question or at least I'm hoping ...
I am trying to select items from a table where the miles field is not
null or blank and the below statement does not work. Does anyone have
any suggestions?
Thanks!
>
> I am trying to select items from a table where the
> miles field is not
> null or blank and the below statement does not work.
> Does anyone have
> any suggestions?
> @resultkeys =
> ("Date","People","Miles","Savings");
>
> $sql = "SELECT c.objectid,c.dateadded as
>
It seems what you are doing is selecting all rows that have miles not equal
to a blank. SO you are displaying / selecting all rows that have miles =
null and miles that have a value that is not a blank string "".
Change the where c.miles part to this:
$sql .= " WHERE c.miles = "" or c.miles is N
Can you share the table create scripts? You need to send us the output of
show create table OWNER.CONFERENCE;
Also send across some sample data.
ANoop
On 4/18/07, Katie L. Barbee <[EMAIL PROTECTED]> wrote:
I believe this is a very simple question or at least I'm hoping ...
I am trying to sel
I believe this is a very simple question or at least I'm hoping ...
I am trying to select items from a table where the miles field is not
null or blank and the below statement does not work. Does anyone have
any suggestions?
Thanks!
@resultkeys = ("Date","People","Miles","Savings
On 4/18/07, Gauthier, Dave <[EMAIL PROTECTED]> wrote:
Hi Jay:
Going back a couple weeks regarding the nested foreach to read out nested
data using XML::Simple, your solution works great, Thanks !
But a new requirement is that I sort the output
foreach (@{$xml->{FOREST}}) {
print $_->{
yitzle wrote:
Any tips on compacting this sub?
sub readFile($) {
my $fileName = shift;
open FILE, "<", $fileName;
while () {
my($name,$oldCount,$oldNum) = split /~/;
$dHash{$name}{'oldCount'} = $oldCount;
$dHash{$name}{'oldNum'} = $oldNum;
}
close FIL
On 4/18/07, yitzle <[EMAIL PROTECTED]> wrote:
I got an array of hashes so I am using a foreach (@arr) loop to access
the hashes.
How do I go about looping through the hash's keys/values? I was
thinking of another foreach, but then the $_ gets a bit screwed up...
Do I need to do this ?
foreach(@
On 4/18/07, yitzle <[EMAIL PROTECTED]> wrote:
I got an array of hashes so I am using a foreach (@arr) loop to access
the hashes.
How do I go about looping through the hash's keys/values? I was
thinking of another foreach, but then the $_ gets a bit screwed up...
Do I need to do this ?
foreach(@a
On 4/18/07, yitzle <[EMAIL PROTECTED]> wrote:
Any tips on compacting this sub?
sub readFile($) {
my $fileName = shift;
open FILE, "<", $fileName;
while () {
my($name,$oldCount,$oldNum) = split /~/;
$dHash{$name}{'oldCount'} = $oldCount;
Any tips on compacting this sub?
sub readFile($) {
my $fileName = shift;
open FILE, "<", $fileName;
while () {
my($name,$oldCount,$oldNum) = split /~/;
$dHash{$name}{'oldCount'} = $oldCount;
$dHash{$name}{'oldNum'} = $oldNum;
I got an array of hashes so I am using a foreach (@arr) loop to access
the hashes.
How do I go about looping through the hash's keys/values? I was
thinking of another foreach, but then the $_ gets a bit screwed up...
Do I need to do this ?
foreach(@arr) {
%hash = %{$_};
foreach (keys %hash) {
The hash was not suggested because of efficiency.
I suggested a hash because they require less coding and make your life
so much easier.
Less coding, less room for errors, nicer code, etc.
Not to mention that filling a hash from a textfile is trivial, so you
can move the associations into a file.
Johnson, Reginald (GTI) wrote:
I don't see what I'm doing wrong here. I just want to compare the value
of $_ and return the indicated string if there is a match.
#!/usr/bin/perl
use strict;
use warnings;
my $temp_proc;
my $mnt_proc = "AVI";
$temp_proc = convert_mnt_proc($mnt_proc);
#
Yes, that solves my problem. I could've looked at the hold day and would
not have caught it.
I guess a hash would be more efficient, but since that's not an issue
for me at this time I'll stick with what I got.
Thanks!
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
On 4/18/07, Johnson, Reginald (GTI) <[EMAIL PROTECTED]> wrote:
if ($_ eq /AVI/) {
return = "Audit Volume";
}
Perl's return operator isn't a variable you assign to. Maybe you want this?
return "Audit Volume"; #
2007/4/18, Johnson, Reginald (GTI) <[EMAIL PROTECTED]>:
if ($_ eq /AVI/) {
Above is not right.
Maybe '$_ =~ /AVI/' or ' $_ eq "AVI" '?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
return = "Audit Volume";
You have
return = "thingy";
You want
return "thingy";
if ($_ eq /AVI/) {
return = "Audit Volume";
}
elsif (/BKP/) {
I don't see what I'm doing wrong here. I just want to compare the value
of $_ and return the indicated string if there is a match.
#!/usr/bin/perl
use strict;
use warnings;
my $temp_proc;
my $mnt_proc = "AVI";
30 matches
Mail list logo