Programming :: Read And Store Key In A Perl Script?
Sep 22, 2010I have a webpage (jps) that produce a key. How i read and store this key in a perl script.
View 1 RepliesI have a webpage (jps) that produce a key. How i read and store this key in a perl script.
View 1 RepliesI am in need of some syntax help. I'm trying to figure out how to store and retrieve an array out of a hash of hashes. For this example, I'm trying to access the city list for a particular state for a particular country. I understand I could do a join and split on the hash key to combine Country and State, but trying to keep things separated.The code I have gets in all the information for the Countries, and states, and gets the list of cities together, no problem. I store all the city names in an array, then make an anonymous pointer to the array for the hash, like this - $MY_CITIES{$COUNTRY}{$STATE} = [@CITIES]I believe that syntax is correct, or is it? What I'd like to do is I need to cycle through every hash to find if a city exists or not. If it exists in 3 states, then it should print 3 times. Here is the code block to search -
Code:
for $COUNTRY (@LIST_OF_COUNTRIES) {
for $STATE ( keys %MY_CITIES{$COUNTRY){$STATE} ) {
[code]...
I am writing a script that involves reading the content of a file present in a directory and/or its sub directory. I know readdir returns all the files & DIR names in a directory but how to check weather readdir is returning a file or a directory
View 2 Replies View RelatedI am trying to read one line at a time in perl and not wait for stdin eof to start the action:
Code:
foreach(<STDIN>){
<do something>
}
if i pipe ls into it, it waits for ls to be done before doing the action.
I would like to find something portable that work on all machines. I have hmtl2text installed, and perl and sh.
Anyone would know if someone already made such thing to read new through the console ?
I am trying to make a perl script which reads data from a file and parse it. The data in the file has the following syntax
Code:
Device Physical Name : Not Visible
Device Symmetrix Name : 1234
Device Serial ID : N/A
Attached BCV Device : N/A
Device Capacity
[Code]...
Each unique record starts with "Device Physical Name". So, I have a set of records within "Device Physical Name". I want to read this set of records starting from "Device Physical Name" and ends up till next "Device Physical Name". Offcourse FS is ":", and I just want to print/or later put info in a csv file.
it's been a while since I logged on here! I've been trying my hand at a little perl and have hit a brick wall.I'm using the Imagemagick module to manipulate some images. I can get the following to work without issue:
Code:
$teampath = "/var/www/team1";
$player=Image::Magick->new;
[code]...
I want to store the return value of $DISPLAY into my perl script. I am new in perl script echo $DISPLAY
how could i make it?
#! /apps/perl/bin/perl
$session = `echo $DISPLAY`;
print "$session
";
but nothing come out
[Code]...
I just learn perl script.May i know how to simplify the code below especially in the red color part? i saw some examples in internet, they use "next" command.
View 20 Replies View RelatedI have two students whose windows laptops are riddled with malware and not working properly. They want me to help them install Linux (which we use in school), but they are concerned about their iTunes.
Having avoided iPods as "defective by design", I know nothing about iTunes whatsoever. However I remember reading about DRM locking and such problems that have me concerned that I won't be able to do it.
Where does iTunes store its stuff?
Can I copy its data store to an external drive, and then into a linux home?
Then will it work on wine, or can another manager (rhythmbox etc) access the itunes data?
Alternatively, if I partition the drive and install linux, can rythmbox/wine/something access itunes data on the win partition?
Supposing they are buying music through iTunes, what will happen to that account?
Finally, one of them has an iphone. Does that work with linux?
Ironic that an apple application is blocking migration away from windows.
i have a loop which produces new value everytime it runs. i want to store the results in an array. how can i do dat??
loop is like:
a=0
declare v
while ((....))
do
v[$a]="$r"
let a=a+1
done
while doing this it is not treating v as array but as variable and it is overriding the value and old value is lost..i am using bash shell version 3.00.15
Code:
ls Again the command can be stored in a variable and then executed. Like
Code:
var=ls
&var
The above two codes are the same. The problem occurs when we try to pipeline it. Consider the following problem:
Code:
ls | grep *
works fine...but when we try to store it in a variable and run the command there is an error.
Code:
var="ls|grep *"
$var
how to store this kind of commands in a variable?
i m trying to store h.264 in avi container using ffmpeg....is it possible using ffmpeg.i m using v4l to capture a image and compressed in to h.264, how i can store it in avi container,any programming example,header format for avi container,and what other information required to store in a container.
View 14 Replies View Relatedwriting a code in C program for debugging error and sendingror messagein routingprotocols. please answer with code
View 2 Replies View RelatedI am trying to store the data in my program in a map of priority_queues an I am having a bit of trouble doing it. basically I am storing activities (ie watching tv, eating dinner, playing ping-pong, etc) and I want these event grouped by the day that they happened on.
my first thought was to use a multimap where the key is the date, and the value is the activity, however I would like to keep the activities in a specific order. I have tried to find the proper syntax for this but have frustratingly come up empty. Even google provided little assistance.
How to write a shell script the would search for a phone no using at the end text file using sed or awk and store it in a varaible or print it.
The text file is in this form
The first line may take any form but the last line will always be Firstname Lastname:KEN:+254456789
I would like to seach for the Phone and store it in a variable and print it.
The phone no will alway be preceeded by ":+"
How do I do this? I wish to store the pictures via a "Browse" button on the webpage, and later display them on a particular page on the site.
View 2 Replies View RelatedI need to find one RUNNING word in latest created logs.
and as soon as i will get RUNNING WORD , i have to execute another Unix Command.
I wrote following script code...
I am working in DM355 board. CPU is armv5t. I am asked to record the video thats coming from camera using rtsp. I can record the video file in avi format on /opt directory on dm355 target board. Now I have to store this avi file in nas server. My nas server ip is 192.168.1.250. Linux pc,DM355 target board and NAS server on same network. How to write the program to store avi files from DM355 to NAS server.
View 2 Replies View RelatedI am working on an structure program and i have to represent a 2,4 tree in a class in Java using single int array and make the insert and delete functions .
View 1 Replies View RelatedI have a requirment where I have to store some data before the system goes to hibernate.
How the kernel intimates to the application when it goes to hibernate. Is there any event or a signal that kernel posts to all applications?
I have to pull certificate from multiple computers which are on network and store it in a single fie or each file belong to a particular computer.I am using certutil -store to import the certificate.
View 4 Replies View RelatedI am writting a program that reads a text file (music.txt) & stores it in a Data Structure. I am a novice learning over the internet so I this is something I have never done. How do I do this?
Quote:
Write a program that reads the data from the music.txt file and store it in a data structure. To implement this data structure you must use an array of songs and each song must be represented by a struct with appropriate fields. So far all I can do is open to file to read it (very simple I know) but so far is it correct?
Code:
#include <iostream>
#include <fstream>
#include <strstream>
[code]....
Suppose I want to account number of files beginning with abc , I can use "ls 'abc* | grep abc | wc -l", this will return me a number.
I want to store this number in a variable, say var1, so I tried
1. "ls 'abc* | grep abc | wc -l |read var1", but this didn't work as var1 has no value somehow.
2. var1='ls 'abc* | grep abc | wc -l', this just assign the entire string "ls 'abc* | grep abc | wc -l" to var1, which is not I wanted.
I don't want to store the value to a temporary file and then read the value from that file. I think there should be a direct way to get the value, but don't know how. I know in tcsh, one can just use set var1='ls 'abc* | grep abc | wc -l', but it also doesn't work in bash. Can anyone give any clue about this?
I'm working with Radiotap headers right now. I want to get the RSSI data. I came through a problem that I can't figure out right now.The value that I need to get is:
Code:
s8 IEEE80211_RADIOTAP_DBM_ANTSIGNAL
now, when I printf it:
[code]...
I am adding inventory control to our online store here at work and I'm not sure of the best approach.Let's say Customer A and Customer B are both looking at the product page for Product X at the same time, and there is only 1 left in stock. What should happen if both click "add to cart" at (more or less) the same time?hould the last Product X get put "on hold" for one of the customers, and then decremented once the sale is complete? Or should the database decrement the product count, and then increment it if the sale doesn't go through successfully?Is it still possible for both to add it to their cart? Are there any mysql features I can use to ensure both cannot purchase the last product?
View 6 Replies View RelatedI was reading about Ruby code blocks, but it's all a bit hazy.My questions:1. Can you store executable code in the value part of a hash (err...associative array)2. If you did, how would you call the code?3. If you executed this stored code, would it be possible when doing soto pass in an object to the code that it could use?
View 1 Replies View RelatedI'm wondering how it is possible to read each line from a text file, and then store each line separately in a list, using C++?
View 2 Replies View RelatedWas trying to write a shell script that has if conditional statements to decide different arguments for a command.Basically:
Code:
if [ "$1" = 1 ]
then
[code]...
I wanna learn how to store data in text file and be able to modify it and save as well using C++.
Note: im using Turbo C++ 3.0