• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

perl send variable

i have a code as given below which works on every minute .
for this line :
my $datadir     = '/var/flows/router1/2013/2013-12/2013-12-18';
bold part is date. and i want to generate this address in the script how should i do it ?


use strict;
use DBI;

# TODO: Change to fit your environment
my $datadir     = '/var/flows/router1/2013/2013-12/2013-12-18';
my $sqlhost     = 'localhost';
my $sqluser     = 'root';
my $sqlpass     = 'gbc1282';
my $sqldbname   = 'ip';
my $sqltable    = 'mytable';
my $coldatetime = 'timestampfromfile';

Open in new window

  • 2
  • 2
1 Solution
my $datadir     = '/var/flows/router1/2013/2013-12/2013-12-18';
print +(split'(/)',$datadir)[-5..-1];
3XLcomAuthor Commented:
i think you mis understood me

my $datadir     = '/var/flows/router1/'. '2013/2013-12/2013-12-18';

bold part will written by perl
# or is this what you meant?
use POSIX ;
my $datadir     = strftime"/var/flows/router1/%Y/%Y-%m/%Y-%m-%d",localtime;
3XLcomAuthor Commented:
that is it thanks
please check out my other questions
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now