just in case you don't like the rex approach and proving TMTOWTDI
File::Basename is good at this sort of thing.
it wont remove the trailing comma however ... best to chop() it off.
use File::Basename;
$file = 'G:/ENT/COR/INB/BANK/test.zip,';
$file = basename($file);
chop($file);
print $file;
why don't doing like this:
$s = "text";
$f = 1;
works($s, $f);
or
$n = 1234;
$f = 0;
works($n, $f);
sub works {
$para = shift;
$flag = shift;
if ($flag == 1) {
# string
} else {
# number
}
}
-
Friedel Wittrock
-Original Message-
From: Ulrich Ho
do like this:
$a = "G:/ENT/COR/INB/BANK/test.zip,";
$b = (split(/\//, $a))[-1];
$b =~ s/,$//;
Friedel Wittrock
-Original Message-
From: Sengupta, Rajib (CC-Contractor)
[mailto:[EMAIL PROTECTED]]
Sent: Monday, June 10, 2002 10:56 PM
To: [EMAIL PROTECTED]
Subject: Stripping of string
> > > > # http:[EMAIL PROTECTED]/msg02542.html
> > > > sub is_number {
> > > > my $bad = 0;
> > > > local $SIG{__WARN__} = sub { $bad++ };
> > > > local $^W = 1;
> > > > my $guess = shift;
> > > > $guess += 0;
> > > > return not $bad;
> > > > }
> > >
> > > not $bad, not $bad, looks like pure
> I'm trying to use any mail perl mod to send email from my server and it
> does'nt work. Here is more info:
C:\>ppm install mime::lite
Installing package 'mime-lite'...
Bytes transferred: 46821
Installing C:\Perl\html\site\lib\MIME\Lite.html
Installing C:\Perl\site\lib\MIME\Lite.pm
Writing C:\Pe
Ulrich Holeschak wrote:
> Why i need to get the data type has the following reason:
> I have a function (for example called sub work()), that can be called in 2
> ways:
>
> 1) work("text");
>
> or
>
> 2) work(12);
>
> In case 1 i want to convert the given text to a list of decimal numbers
> r
You would use the module I just posted and do something like:
$Var1 = 1234; SvNIOK($Var1);
This will return true: 1234 will create a SvIV or 16 bit number
$Var2 = "1234"; SvNIOK($Var2);
This will return false since that was the string representation of a number but not actually a number
Now che
Just my guess: you'll probably need to replace all @ with \@ in the
regexp...
Sem mais assunto de momento,
Fernando Madruga
ASC:DSI
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of
Walter Usyk
Sent: segunda-feira, 3 de Junho de 2002 19:01
To: [EMA
my $str1 =
"/vobs/spifftest/.@@/HDX.LU/lineups/.@@/HDX.LU/hdx.lu@@/main/LATEST";
#my $str1 = "/vobs/spifftest/lineups/hdx.lu";
my $FullName = "";
my $Name = "";
my $Version = "";
##
# I'm using | as the quote in place of / for
# the regex m// -> m||
##
if($str1 =~ m|.*/(\w{2,}\.?\w+\
> Try Devel::Dumper instead. It tries harder.
I'm having trouble finding this on CPAN. Can you point me to it?
___
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Why i need to get the data type has the following reason:
I have a function (for example called sub work()), that can be called in 2
ways:
1) work("text");
or
2) work(12);
In case 1 i want to convert the given text to a list of decimal numbers
representing the asc values (via ord()).
In case 2
Hello,
how can i find out the internal data representation (data type) of a perl
variable?
Example:
$Var1 = 1234;# this is an integer
$Var2 = "1234";# this is an string
I want to know if $VarX is internally stored as integer or as string.
Ulrich Holeschak
Bihl+Wiedemann Gmb
On Fri, 31 May 2002, Haimov, Eugene wrote:
> Use "pack()" function on $currentdate,
> then syswrite its result.
>
> -Original Message-
> From: Michele Knight [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 31, 2002 4:10 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: Addi
On Mon, 3 Jun 2002, Walter Usyk wrote:
> I'm having a problem with a regular expression and I hope that someone
> can help me out with.
>
> I have the following:
>
> my $envLU
> ="/vobs/spifftest/.@@/HDX.LU/lineups/.@@/HDX.LU/hdx.lu@@/main/LATEST";
> $envLU =~ s/^(.*\/)([^\/]+@@[^@@]+)$/$2/;
>
Correction to my previous post:
You'll probably need to preceed all @ in the $envLU variable with a \,
that is:
my $envLU
="/vobs/spifftest/.\@\@/HDX.LU/lineups/.\@\@/HDX.LU/hdx.lu\@\@/main/LATE
ST";
Otherwise, just use single quotes instead of double ones like this:
my $envLU
='/vobs/spifftest
Use qq instead of qw to get the variable interpolation.
Eric Winter, SSAI, NASA GSFC Code 662
[EMAIL PROTECTED]
(301) 286-2316 Office: T2, Room 56
On Tue, 4 Jun 2002 [EMAIL PROTECTED] wrote:
> Dear all,
>
>
> I was trying to do this
>
> print "please input your variable:\n";
> $variable = ;
16 matches
Mail list logo